A meal preparation service backend application built with Go. This application allows users to select upcoming meals for the week, make purchases, and have them delivered.
- Go (Golang)
- PostgreSQL for primary data storage
- Redis for caching
- OAuth2 (Google) for authentication
- Gin framework for API routing
- GORM for database ORM
The app uses a structured configuration system with support for different environments:
- development - For local development
- test - For running tests
- production - For production deployment
Configuration is loaded in the following order (later sources override earlier ones):
- Default values from the code
- Base configuration from
config/config.yaml - Environment-specific configuration from
config/config.[environment].yaml - Environment variables (override everything else)
Key environment variables:
APP_ENV: Sets the application environment (development, test, production)DATABASE_*: Database configurationREDIS_*: Redis configurationAUTH_*: Authentication configurationSERVER_*: Server configuration
-
Clone the repository
git clone <repository-url> cd meals
-
Set up development environment
make dev-setup
-
Copy VS Code settings (optional)
cp .vscode/settings.json.template .vscode/settings.json
-
Start the application
make dev
This will start PostgreSQL, Redis, and the application automatically.
-
Install dependencies
go mod tidy
-
Start databases
make docker-up
-
Run the application
make run
Run make help to see all available commands:
make help # Show all commands
make dev-setup # Set up development environment
make run # Run the application
make test # Run tests
make search-funcs # Find all functions
make search-routes # Find all routes
make docs # Generate API documentationGET /auth/google: Start Google OAuth2 authenticationGET /auth/google/callback: Google OAuth2 callback URLGET /logout: Log out the current user
GET /meals: List all mealsPOST /meals: Create a new mealGET /meals/:id: Get a specific mealPUT /meals/:id: Update a mealDELETE /meals/:id: Delete a meal
POST /menus: Create a new menuPUT /menus: Update a menu
The application includes Docker and Docker Compose configurations for easy deployment.
# Build and start all containers
docker-compose up -d
# View logs
docker-compose logs -f
# Stop all containers
docker-compose downYou can create a .env file in the project root to configure the Docker deployment:
APP_ENV=production
DATABASE_USER=meals_app_user
DATABASE_PASSWORD=strong_password
DATABASE_NAME=meals_production_db
AUTH_GOOGLEKEY=your_google_client_id
AUTH_GOOGLESECRET=your_google_client_secret
AUTH_GOOGLEREDIRECTURL=https://your-domain.com/auth/google/callback
AUTH_SESSIONSECRET=your_session_secret_key
- Architecture:
docs/architecture/README.md- System design and components - API Reference:
docs/api/openapi.yaml- OpenAPI 3.1 specification - Database Schema:
docs/database/schema.md- Database structure and relationships - Project Navigation:
docs/project-map.md- Quick reference for code locations
# Find all functions
make search-funcs
# Find all routes
make search-routes
# Find all models
make search-models
# Find error handling patterns
make search-errors
# Find database operations
make search-dbmake test # Run all tests
make test-verbose # Run with verbose output
make test-coverage # Generate coverage reportmake lint # Run linter
make format # Format code
make vet # Run go vetmeals/
├── docs/ # Documentation
├── handlers/ # HTTP request handlers
├── models/ # Database models
├── auth/ # Authentication & authorization
├── middleware/ # HTTP middleware
├── store/ # Database layer
├── config/ # Configuration management
├── routes/ # Route definitions
└── tests/ # Test suites
This project is licensed under the MIT License.