-
Notifications
You must be signed in to change notification settings - Fork 6
Feature/fs content #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature/fs content #109
Changes from all commits
b5f0424
ebb15ff
be4f3fa
e4725eb
fbc89b6
e8b605a
52f264d
188a316
1556b29
f3570f9
ea76b21
c25672e
5ffcc15
67f60bb
da8d2df
82a4aa2
0ec605d
3218be0
edf533d
0c529cb
6bfa30f
ac82f45
bc8d23a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,165 @@ | ||
| !!! warning "Work in progress" | ||
|
|
||
| # Useful Scripts & Tools | ||
|
|
||
| A collection of commonly used scripts and commands for day-to-day development work. | ||
|
|
||
| ## Database Scripts | ||
|
|
||
| ### Reset Local Database | ||
|
|
||
| Drops and recreates the database, runs migrations, and seeds development data: | ||
|
|
||
| ```bash | ||
| #!/bin/bash | ||
| # scripts/db-reset.sh | ||
|
|
||
| echo "Dropping and recreating database..." | ||
| docker compose exec postgres psql -U myuser -c "DROP DATABASE IF EXISTS mydb;" | ||
| docker compose exec postgres psql -U myuser -c "CREATE DATABASE mydb;" | ||
|
|
||
| echo "Running migrations..." | ||
| docker compose exec api npm run migrate | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| echo "Seeding development data..." | ||
| docker compose exec api npm run seed | ||
|
|
||
| echo "Database reset complete." | ||
| ``` | ||
|
|
||
| ### Database Dump and Restore | ||
|
|
||
| ```bash | ||
| # Export a database dump | ||
| docker compose exec -T postgres pg_dump -U myuser mydb > backup.sql | ||
|
|
||
| # Import a database dump | ||
| docker compose exec -T postgres psql -U myuser mydb < backup.sql | ||
| ``` | ||
|
|
||
| ### Quick Migration Commands | ||
|
|
||
| ```bash | ||
| # Prisma | ||
| docker compose exec api npx prisma migrate dev --name description_of_change | ||
| docker compose exec api npx prisma generate | ||
| docker compose exec api npx prisma studio # Visual database browser | ||
|
|
||
| # TypeORM | ||
| docker compose exec api npx typeorm migration:generate -n MigrationName | ||
| docker compose exec api npx typeorm migration:run | ||
| docker compose exec api npx typeorm migration:revert | ||
| ``` | ||
|
|
||
| ## Docker Scripts | ||
|
|
||
| ### Clean Rebuild | ||
|
|
||
| When things are broken and you want a fresh start: | ||
|
|
||
| ```bash | ||
| # Stop everything, remove volumes, rebuild | ||
| docker compose down -v | ||
| docker compose build --no-cache | ||
| docker compose up -d | ||
| ``` | ||
|
|
||
| ### View Logs | ||
|
|
||
| ```bash | ||
| # Follow all logs | ||
| docker compose logs -f | ||
|
|
||
| # Follow a specific service | ||
| docker compose logs -f api | ||
|
|
||
| # Show last 100 lines | ||
| docker compose logs --tail=100 api | ||
| ``` | ||
|
|
||
| ### Shell Access | ||
|
|
||
| ```bash | ||
| # Open a shell in the API container | ||
| docker compose exec api sh | ||
|
|
||
| # Run a one-off command | ||
| docker compose exec api npm run lint | ||
| ``` | ||
|
|
||
| ## Development Helpers | ||
|
|
||
| ### Generate NestJS Resources | ||
|
|
||
| ```bash | ||
| # Generate a complete CRUD module | ||
| npx nest generate resource users | ||
|
|
||
| # Generate individual components | ||
| npx nest generate module users | ||
| npx nest generate service users | ||
| npx nest generate controller users | ||
| ``` | ||
|
|
||
| ### Quick Dependency Check | ||
|
|
||
| ```bash | ||
| # Check for outdated packages | ||
| npm outdated | ||
|
|
||
| # Check for security vulnerabilities | ||
| npm audit | ||
|
|
||
| # Update all packages to latest within semver range | ||
| npm update | ||
| ``` | ||
|
|
||
| ### TypeScript Type Checking | ||
|
|
||
| ```bash | ||
| # Run type checker without emitting files | ||
| npx tsc --noEmit | ||
|
|
||
| # Watch mode for continuous type checking | ||
| npx tsc --noEmit --watch | ||
| ``` | ||
|
|
||
| ## Git Helpers | ||
|
|
||
| ### Clean Up Local Branches | ||
|
|
||
| ```bash | ||
| # Delete all local branches that have been merged to develop | ||
| git branch --merged develop | grep -v "develop\|main" | xargs git branch -d | ||
|
|
||
| # Prune remote tracking branches that no longer exist | ||
| git remote prune origin | ||
| ``` | ||
|
|
||
| ### Quick Rebase on Develop | ||
|
|
||
| ```bash | ||
| git fetch origin | ||
| git rebase origin/develop | ||
| ``` | ||
|
|
||
| ## npm Scripts Convention | ||
|
|
||
| Every project should define these scripts in `package.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "scripts": { | ||
| "dev": "nest start --watch", | ||
| "build": "nest build", | ||
| "start": "node dist/main.js", | ||
| "lint": "eslint . --fix", | ||
| "format": "prettier --write .", | ||
| "test": "jest", | ||
| "test:watch": "jest --watch", | ||
| "test:e2e": "jest --config jest.e2e.config.ts", | ||
| "migrate": "prisma migrate deploy", | ||
| "migrate:dev": "prisma migrate dev", | ||
| "seed": "ts-node prisma/seed.ts", | ||
| "type-check": "tsc --noEmit" | ||
| } | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,129 @@ | ||
| !!! warning "Work in progress" | ||
|
|
||
| # FAQ | ||
|
|
||
| Answers to common questions from new team members and recurring topics. | ||
|
|
||
| ## Onboarding | ||
|
|
||
| ### How do I get access to the project repositories? | ||
|
|
||
| Ask your team lead to add you to the [Futured GitHub organization](https://github.com/futuredapp). You'll need a GitHub account. Once added, you'll have access to all team repositories. | ||
|
|
||
| ### How do I set up my local environment? | ||
|
|
||
| Follow the [Local Setup Instructions](../dev_env/00_local_setup.md). In short: | ||
|
|
||
| 1. Install Node.js (via nvm), Docker Desktop (or OrbStack on Mac), and Git | ||
| 2. Clone the repository | ||
| 3. Copy `docker-compose.dist.yml` to `docker-compose.yml` and fill in the values | ||
| 4. Run `docker compose up -d` | ||
| 5. Run migrations and seed data | ||
|
|
||
| ### Where do I find the environment variables? | ||
|
|
||
| Ask your team lead or a colleague working on the project. Credentials are shared securely (not via Slack/email). See [Secrets Management](../dev_env/10_secrets.md) for the full process. | ||
|
|
||
| ### Which IDE should I use? | ||
|
|
||
| We don't mandate a specific IDE. Most team members use: | ||
|
|
||
| - **WebStorm** (JetBrains) — Full-featured, excellent TypeScript/Vue support | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Přidala bych, že je to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a je? já si to nechávám proplácet 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aha, to je vtipné, mi bylo řečeno, že si to mám zaplatit sama 🙂 |
||
| - **VS Code** — Lightweight, great with extensions | ||
| - **Cursor** — VS Code fork with built-in AI features | ||
|
|
||
| Whatever you use, make sure ESLint and Prettier are configured to run on save. | ||
|
|
||
| ## Development | ||
|
|
||
| ### REST or GraphQL — which should I use? | ||
|
|
||
| See the [Backend](../tech_stack/10_backend.md) page for a comparison table. In short: | ||
|
|
||
| - **REST** for simple CRUD, public APIs, file operations, webhooks | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and scheduled jobs |
||
| - **GraphQL** for complex data relationships, flexible frontend queries, real-time subscriptions | ||
|
|
||
| Most projects start with REST. Use GraphQL when the frontend needs outgrow simple endpoints. | ||
|
|
||
| ### How do I create a new feature branch? | ||
|
|
||
| ```bash | ||
| git checkout develop | ||
| git pull origin develop | ||
| git checkout -b feature/ABC-123-short-description | ||
| ``` | ||
|
|
||
| See [Git Flow](../development/00_git_flow.md) for the full branching model. | ||
|
|
||
| ### How do I handle database schema changes? | ||
|
|
||
| Always use migrations. Never modify the database schema manually. See the migration sections in [Database](../tech_stack/20_database.md) and [Deployment](../deployment/00_deployment.md). | ||
|
|
||
| ### Why do we use Docker for local development? | ||
|
|
||
| Docker ensures everyone runs the same environment regardless of their OS. It eliminates "works on my machine" issues, makes onboarding faster, and keeps dependencies (PostgreSQL, Redis, etc.) isolated from your system. | ||
|
|
||
| ### How do I add a new npm package? | ||
|
|
||
| ```bash | ||
| # npm | ||
| npm install package-name # production dependency | ||
| npm install -D package-name # development dependency | ||
|
|
||
| # yarn | ||
| yarn add package-name # production dependency | ||
| yarn add -D package-name # development dependency | ||
| ``` | ||
|
|
||
| Before adding a package, check: | ||
|
|
||
| - Is it actively maintained? | ||
| - Does it have TypeScript types? | ||
| - Does it add significant bundle size? (check on [bundlephobia.com](https://bundlephobia.com)) | ||
| - Is there already a similar package in the project? | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ještě mi tu chybí push 😆 a před pushem spustit testy |
||
| ## Code Review | ||
|
|
||
| ### How quickly should I review a PR? | ||
|
|
||
| Aim to start a review within the same business day. If you can't review in time, let the author know so they can find another reviewer. | ||
|
|
||
| ### What should I focus on during code review? | ||
|
|
||
| 1. **Correctness** — Does the code do what it's supposed to? | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Chybí mi tu ještě |
||
| 2. **Security** — Are there any vulnerabilities (SQL injection, XSS, exposed secrets)? | ||
| 3. **Architecture** — Does it fit the project structure? Is it in the right module? | ||
| 4. **Edge cases** — What happens with empty input, null values, concurrent requests? | ||
| 5. **Tests** — Are critical paths tested? | ||
|
|
||
| See [Code Review Process](../development/20_code_review_process.md) for the full guidelines. | ||
|
|
||
| ### Can I use AI tools for code review? | ||
|
|
||
| Yes. We use Copilot and CodeRabbit for automated analysis. They catch common issues and provide suggestions. However, AI review supplements — it doesn't replace — human review. Always verify AI suggestions against the project context. | ||
|
|
||
| ## Deployment | ||
|
|
||
| ### How do I deploy to the dev environment? | ||
|
|
||
| Merge your PR to `develop`. The CI/CD pipeline will automatically build and deploy. | ||
|
|
||
| ### How do I deploy to production? | ||
|
|
||
| Create a PR from `develop` to `main`. After approval and merge, the pipeline deploys automatically. See [Deployment Process](../deployment/00_deployment.md). | ||
|
|
||
| ### What do I do if a deployment breaks production? | ||
|
|
||
| Follow the [Rollback Procedures](../deployment/10_rollback.md). The quickest fix is usually redeploying the previous container image. | ||
|
|
||
| ## Architecture Decisions | ||
|
|
||
| ### Why NestJS instead of Express? | ||
|
|
||
| NestJS provides structure, dependency injection, and modularity out of the box. Express gives you freedom but requires you to build all of that yourself. For team projects, the consistency of NestJS saves more time than the flexibility of Express. | ||
|
|
||
| ### Why Vue instead of React? | ||
|
|
||
| Vue was adopted as our primary frontend framework based on team experience and project needs. Vue's Composition API + TypeScript provides an excellent developer experience. For projects where React is a better fit (e.g., client requirement, React Native), we use React. | ||
|
|
||
| ### Why PostgreSQL as the default database? | ||
|
|
||
| PostgreSQL offers the best balance of reliability, features, and performance for our typical use cases (transactional web applications). It handles JSON data well enough to cover most semi-structured data needs too. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chybí mi tu zmínka o SSG, když už ho používáme 🙂