### Install Frontend Dependencies with pnpm Source: https://nextfastapi.com/get-started Installs frontend dependencies using pnpm. This command is run after navigating to the frontend directory. ```shell pnpm install ``` -------------------------------- ### Copy Backend Environment File Source: https://nextfastapi.com/get-started Copies the example environment file to .env in the backend directory and navigates into it. This is the first step in configuring backend environment variables. ```shell cd fastapi_backend && cp .env.example .env ``` -------------------------------- ### Copy Frontend Environment File Source: https://nextfastapi.com/get-started Copies the example environment file to .env.local in the frontend directory and navigates into it. Frontend environment variables are typically configured here. ```shell cd nextjs-frontend && cp .env.example .env.local ``` -------------------------------- ### Start Backend Server (No Docker) Source: https://nextfastapi.com/get-started Starts the FastAPI backend server using a make command. This is for running the backend locally without Docker. ```shell make start-backend ``` -------------------------------- ### Install pnpm with npm Source: https://nextfastapi.com/get-started Installs the pnpm package manager globally using npm. pnpm is used for managing frontend dependencies. ```shell npm install -g pnpm ``` -------------------------------- ### Start Backend Server Container Source: https://nextfastapi.com/get-started Starts the FastAPI backend server within its Docker container using a make command. This is for running the backend with Docker. ```shell make docker-start-backend ``` -------------------------------- ### Build Docker Images for Project Source: https://nextfastapi.com/get-started Builds the Docker images for both the backend and frontend using a make command. This prepares the project for containerized execution. ```shell make docker-build ``` -------------------------------- ### Build and Start Database Container Source: https://nextfastapi.com/get-started Builds the database Docker image and starts the database container in detached mode. This is used to run the database for the project. ```shell docker compose build db docker compose up -d db ``` -------------------------------- ### Sync Backend Dependencies with uv Source: https://nextfastapi.com/get-started Synchronizes backend dependencies using the uv tool. This command is run after navigating to the backend directory. ```shell uv sync ``` -------------------------------- ### Start Frontend Development Server (No Docker) Source: https://nextfastapi.com/get-started Starts the Next.js development server using a make command. This is for running the frontend locally without Docker. ```shell make start-frontend ``` -------------------------------- ### Apply Database Migrations in Docker Source: https://nextfastapi.com/get-started Applies database migrations using a make command, assuming a Dockerized environment for the database. This ensures the database schema is up-to-date. ```shell make docker-migrate-db ``` -------------------------------- ### Start Frontend Development Server Container Source: https://nextfastapi.com/get-started Starts the Next.js development server within its Docker container using a make command. This is for running the frontend with Docker. ```shell make docker-start-frontend ``` -------------------------------- ### Install Vercel CLI Source: https://nextfastapi.com/deployment Installs the latest version of the Vercel Command Line Interface (CLI) globally using pnpm. This tool is essential for interacting with Vercel for deployments and project linking. ```shell pnpm i -g vercel@latest ``` -------------------------------- ### Install Pre-Commit Hooks Source: https://nextfastapi.com/additional-settings Commands to install pre-commit hooks for maintaining code quality. Separate installations are required for local and Docker configurations. ```bash pre-commit install -c .pre-commit-config.yaml ``` ```bash pre-commit install -c .pre-commit-config.docker.yaml ``` -------------------------------- ### Serve Documentation Locally with mkdocs-material Source: https://nextfastapi.com/contributing Runs the mkdocs serve command to generate and serve the project documentation locally. This command requires mkdocs-material to be installed. ```shell uv run mkdocs serve ``` -------------------------------- ### Start MailHog Local Email Server Source: https://nextfastapi.com/additional-settings Command to start the MailHog service for local email testing. The email client can then access the server at http://localhost:8025. ```bash make docker-up-mailhog ``` -------------------------------- ### Link Next.js Frontend to Vercel Source: https://nextfastapi.com/deployment Links the local Next.js frontend project directory to an existing Vercel project. This command initiates the process of connecting your local development environment to your Vercel deployment. ```shell cd nextjs-frontend vercel link ``` -------------------------------- ### Export FastAPI Dependencies Source: https://nextfastapi.com/deployment Exports the current project dependencies from the uv environment into a requirements.txt file. This is required for Vercel deployments when the uv.lock file has been modified, ensuring all necessary packages are included. ```shell cd fastapi_backend uv export > requirements.txt ``` -------------------------------- ### Authenticate Vercel Account Source: https://nextfastapi.com/deployment Logs the user into their Vercel account using the Vercel CLI. This command is necessary to authorize the CLI to perform actions on your Vercel projects. ```bash vercel login ``` -------------------------------- ### Generate Backend Secret Key Source: https://nextfastapi.com/get-started Generates a new 32-byte hexadecimal secret key using Python's secrets module. This key is used for security in the backend configuration. ```python import secrets; print(secrets.token_hex(32)) ``` -------------------------------- ### Link FastAPI Backend to Vercel Source: https://nextfastapi.com/deployment Links the local FastAPI backend project directory to a Vercel project using a specific local configuration file. This allows Vercel to correctly identify and deploy the backend service. ```shell cd fastapi_backend vercel link --local-config=vercel.prod.json ``` -------------------------------- ### Move CI/CD Workflow Files Source: https://nextfastapi.com/deployment Moves the production deployment workflow files for both backend and frontend to the correct directory for GitHub Actions to recognize them. This ensures that your CI/CD pipeline is set up correctly for production deployments. ```shell mv prod-backend-deploy.yml .github/workflows/prod-backend-deploy.yml mv prod-frontend-deploy.yml .github/workflows/prod-frontend-deploy.yml ``` -------------------------------- ### Display Makefile Help Source: https://nextfastapi.com/additional-settings Command to view all available commands and their descriptions provided by the project's Makefile, which simplifies common development tasks. ```bash make help ``` -------------------------------- ### Run Tests (Backend & Frontend) Source: https://nextfastapi.com/additional-settings Commands to execute backend and frontend tests. Requires the test database container to be running. Tests can be run locally or through Docker. ```bash make docker-up-test-db ``` ```bash make test-backend ``` ```bash make test-frontend ``` ```bash make docker-test-backend ``` ```bash make docker-test-frontend ``` -------------------------------- ### Create and Apply Alembic Database Migrations Source: https://nextfastapi.com/additional-settings Commands for managing database schema changes using Alembic. First, create a new migration with a specified name, then apply it to the database. ```bash make docker-db-schema migration_name="add users" ``` ```bash make docker-migrate-db ``` -------------------------------- ### Generate Frontend Client (Next.js) Source: https://nextfastapi.com/additional-settings Command to generate the frontend client code based on the OpenAPI schema. This is typically run within the Next.js frontend directory. Can be executed locally or via Docker. ```bash cd nextjs-frontend && npm run generate-client ``` ```bash docker compose run --rm --no-deps -T frontend npm run generate-client ``` -------------------------------- ### Clone Next.js FastAPI Template Repository Source: https://nextfastapi.com/contributing Clones the Next.js FastAPI Template repository from GitHub to set up the project locally. This is the first step for any contributor. ```git git clone git@github.com:vintasoftware/nextjs-fastapi-template.git ``` -------------------------------- ### Run Pre-Commit Checks Source: https://nextfastapi.com/additional-settings Manually trigger pre-commit checks on all files in the repository. Supports both local and Docker-based pre-commit configurations. ```bash pre-commit run --all-files -c .pre-commit-config.yaml ``` ```bash pre-commit run --all-files -c .pre-commit-config.docker.yaml ``` -------------------------------- ### Update Pre-Commit Hooks Source: https://nextfastapi.com/additional-settings Command to update all pre-commit hooks to their latest available versions, ensuring the project uses the most recent code quality tools. ```bash pre-commit autoupdate ``` -------------------------------- ### Generate OpenAPI Schema (FastAPI) Source: https://nextfastapi.com/additional-settings Command to export the OpenAPI JSON schema from the FastAPI backend. This is used for frontend client generation. Can be run locally or within a Docker container. ```bash cd fastapi_backend && uv run python -m commands.generate_openapi_schema ``` ```bash docker compose run --rm --no-deps -T backend uv run python -m commands.generate_openapi_schema ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.