A modern full-stack recipe management application built with FastAPI (backend) and Next.js (frontend).
- Backend: FastAPI with PostgreSQL database
- Frontend: Next.js with Mantine UI components
- Authentication: JWT-based with access/refresh tokens
- Development: Docker Compose for backend services
- Docker and Docker Compose
- Node.js v20.9.0 (LTS)
- npm or yarn
# Start backend services (database + API)
./scripts/dev-start.sh
# Run database migrations
./scripts/migrate.shThe backend will be available at http://localhost:8000
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Configure environment
cp .env.example .env.local
# Start development server
npm run devThe frontend will be available at http://localhost:3000
-
Start backend services:
./scripts/dev-start.sh
-
Start frontend:
cd frontend && npm run dev
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- View logs:
docker-compose logs -f backend - Run tests:
./scripts/test.sh - Create migration:
./scripts/migrate-create.sh "Description" - Apply migrations:
./scripts/migrate.sh
- Build for production:
npm run build - Analyze bundle:
npm run analyze - Lint code:
npm run lint
├── backend/ # FastAPI backend
│ ├── app/ # Application code
│ ├── alembic/ # Database migrations
│ ├── tests/ # Backend tests
│ └── requirements.txt # Python dependencies
├── frontend/ # Next.js frontend
│ ├── src/ # Source code
│ ├── public/ # Static assets
│ └── package.json # Node dependencies
├── scripts/ # Development scripts
├── infrastructure/ # Database setup
└── docker-compose.yml # Docker services
- JWT-based authentication with secure token management
- Automatic token refresh
- Protected routes and API endpoints
- Create, edit, and delete recipes
- Rich text editor for descriptions
- Ingredient and instruction management
- Recipe search and filtering
- React with TypeScript
- Mantine UI component library
- Optimistic updates for better UX
- Code splitting and lazy loading
- Progressive loading states
- FastAPI with automatic API documentation
- PostgreSQL with Alembic migrations
- Comprehensive error handling
- Security audit logging
SECRET_KEY=your_256_bit_secret_key_here
DATABASE_URL=postgresql://recipe_user:recipe_password@localhost:5432/recipe_dbNEXT_PUBLIC_API_BASE_URL=http://localhost:8000
NODE_ENV=developmentWhen the backend is running, visit:
- Interactive docs: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
# Run all tests
./scripts/test.sh
# Run specific test types
./scripts/test.sh -t unit
./scripts/test.sh -t integration
./scripts/test.sh -t api
# Run with coverage
./scripts/test.sh -ccd frontend
npm run test # (when implemented)┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Vercel │────▶│ Cloud Run │────▶│ Supabase │
│ (Frontend) │ │ (Backend) │ │ (PostgreSQL) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
First-time setup:
# 1. Install gcloud CLI: https://cloud.google.com/sdk/docs/install
# 2. Authenticate
gcloud auth login
# 3. Run setup script (enables required APIs)
./scripts/setup-gcp.sh --project YOUR_PROJECT_IDDeploy:
./scripts/deploy-cloudrun.sh --project YOUR_PROJECT_IDEnvironment Variables (set in Cloud Run Console):
| Variable | Description |
|---|---|
DATABASE_URL |
Supabase PostgreSQL connection string |
SECRET_KEY |
JWT secret (256-bit hex) |
CORS_ORIGINS |
Allowed origins, e.g., ["https://your-app.vercel.app"] |
- Optimized for Vercel deployment
- Set
NEXT_PUBLIC_API_BASE_URLto your Cloud Run URL - Bundle optimization and code splitting
-
Port conflicts:
lsof -i :3000,8000,5432
-
Docker issues:
./scripts/cleanup.sh --all ./scripts/build.sh --force
-
Database connection:
docker-compose logs database docker-compose restart database
# Stop everything and clean up
./scripts/dev-stop.sh --cleanup --volumes
./scripts/cleanup.sh --all
# Rebuild and restart
./scripts/build.sh --force
./scripts/dev-start.sh
./scripts/migrate.sh
# Start frontend
cd frontend && npm run dev- Follow the existing code style and patterns
- Write tests for new features
- Update documentation as needed
- Use the provided development scripts
- JWT tokens with secure secret key management
- Input validation and sanitization
- SQL injection protection via SQLAlchemy ORM
- CORS configuration for cross-origin requests
- Security audit logging
For detailed script documentation, see scripts/README.md.