A beautiful, modern full-stack web application for discovering and exploring specialty coffee roasters. Built with Next.js 14, Express.js, and PostgreSQL in a Docker-first development environment.
- Location-based Discovery: Find coffee roasters near you
- Roaster Profiles: Detailed information including contact info, hours, and bean offerings
- Owner Contact Information: Store roaster owner details (name, email, bio, mobile)
- User Authentication: Secure sign up and login system
- Reviews & Favourites: Rate roasters and save your favourites
- Image Uploads: Upload and share roaster photos
- Notifications: Stay updated on new roasters and activity
- Secure API: RESTful API with comprehensive Swagger documentation
- Internationalization: Full i18n support (English/French)
- Beautiful Design: Purple-themed UI with lavender, violet, and orchid colors
- Admin Dashboard: Complete user and role management (admin only)
- Audit Logging: Comprehensive activity tracking with geolocation and change history
- Responsive Design: Works seamlessly on desktop, tablet, and mobile
- Docker-First: Containerized development and deployment
- Frontend: Next.js 14 (App Router) with TypeScript
- Backend: Express.js API with Prisma ORM
- Database: PostgreSQL
- Deployment: Docker-based containerization
- CDN: Cloudflare for assets and domain management
Critical: This project requires Docker container restarts for code changes to take effect. Hot reload is unreliable due to Docker volume mounting.
-
Clone the repository
git clone https://github.com/thephm/the-beans.git cd the-beans -
Start all services
docker-compose up --build
-
Access the applications
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
- API Documentation: http://localhost:5000/api-docs
Essential: Always restart containers after code changes:
# After making frontend changes
docker-compose restart client
# After making backend changes
docker-compose restart server
# Rebuild everything if needed
docker-compose up --build
# Stop all services
docker-compose down- Email:
admin@example.com - Password:
admin123
# Connect to PostgreSQL shell
docker exec -it the-beans-database-1 psql -U beans_user -d the_beans_db
# Check admin users
docker exec -it the-beans-database-1 psql -U beans_user -d the_beans_db -c "SELECT email, username, role FROM users WHERE role = 'admin';"
# Run database migrations
docker-compose exec server npx prisma migrate dev
# Generate Prisma client after schema changes
docker-compose exec server npx prisma generate
# Reset database (careful!)
docker-compose exec server npx prisma migrate resetTo enable the Contact Us form and email notifications, configure the following environment variables in server/.env:
# Email Recipients
CONTACT_US_EMAIL=your-contact-email@example.com # Receives Contact Us form submissions
ADMIN_EMAIL=admin@example.com # Receives admin notifications
# SMTP Server Configuration
SMTP_HOST=smtp.yourprovider.com # e.g., smtp.gmail.com, smtp.fastmail.com
SMTP_PORT=587 # 587 for TLS, 465 for SSL
SMTP_USER=your-smtp-username # Usually your email address
SMTP_PASS=your-smtp-password # App-specific password or API keyAfter updating .env, restart the server container:
docker-compose restart serverFor detailed setup instructions including Gmail, Fastmail, SendGrid, and troubleshooting, see the π§ Email Configuration Guide.
Comprehensive documentation is maintained in the docs/ directory following docs-as-code principles.
- Authentication System
- Search & Discovery
- Roaster Management
- Favourites & Reviews
- User Profiles
- Settings & Preferences
- Admin Dashboard
- Audit Logging
the-beans/
βββ client/ # Next.js 14 Frontend
β βββ src/
β β βββ app/ # App Router pages & layouts
β β βββ components/ # Reusable React components
β β βββ contexts/ # React Context providers
β β βββ lib/ # Utilities & configurations
β β βββ types/ # TypeScript type definitions
β βββ public/
β β βββ locales/ # i18n translation files
β β βββ images/ # Static images & icons
β βββ Dockerfile # Frontend container config
βββ server/ # Express.js Backend
β βββ src/
β β βββ routes/ # RESTful API endpoints
β β βββ middleware/ # Auth & validation middleware
β β βββ lib/ # Server utilities
β βββ prisma/
β β βββ schema.prisma # Database schema
β β βββ migrations/ # Database migrations
β β βββ seed.ts # Database seeding
β βββ uploads/ # File upload storage
β βββ Dockerfile # Backend container config
βββ docs/ # Documentation (docs-as-code)
βββ docker-compose.yml # Multi-service orchestration
βββ Various config files # Setup, CI/CD, etc.
- Authentication:
optionalAuth(public),requireAuth(protected) - Admin Routes: Check
user.role === 'admin' - Validation: express-validator for input sanitization
- Error Handling: Consistent JSON error responses
- Centralized API client with JWT token management
- Base URL:
http://localhost:5000(configurable) - Automatic token injection and refresh
# After schema changes
docker-compose exec server npx prisma generate
docker-compose exec server npx prisma migrate dev- Backend: Add routes in
server/src/routes/with proper middleware - Frontend: Create components in
client/src/components/ - Database: Update
server/prisma/schema.prisma+ generate + migrate - i18n: Add translations to
client/public/locales/{en,fr}/common.json - Restart: Always restart containers after changes
- Frontend: Jest + React Testing Library
- Backend: Jest + Supertest for API testing
- E2E: Playwright for integration tests
- Manual: Admin dashboard at
/admin(requires admin login)
For complete deployment documentation, see the Deployment Guide.
The Beans includes a complete render.yaml configuration for one-click deployment on Render.com:
- Connect your GitHub repository to Render.com
- Create a new Blueprint from your repository (Render will detect
render.yaml) - Configure environment variables in Render dashboard:
# Required for all deployments CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_secret # For custom domains (optional) CORS_ORIGIN=https://yourdomain.com NEXT_PUBLIC_API_URL=https://api.yourdomain.com - Deploy - Render will automatically create:
- PostgreSQL database
- Backend API service (Express.js)
- Frontend web service (Next.js)
Alternative deployment using Docker containers with docker-compose.yml.
# Automatic via render.yaml build process
# Or manual via Render shell:
npx prisma migrate deploy
npx prisma generate- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Develop using Docker:
docker-compose up --build - Restart containers after changes:
docker-compose restart client server - Test your changes thoroughly
- Commit your changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Submit a pull request
- TypeScript: Strict typing required
- ESLint: Follow configured rules
- Prettier: Auto-formatting enabled
- i18n: All user-facing text must be translatable
- Tests: Include tests for new features
- Documentation: Update docs for new features
- Always restart containers after code changes:
docker-compose restart client server - Hot reload is unreliable in the Docker environment
- Database changes require Prisma generate + migrate
- New translations require client container restart
- The project builds TypeScript sources into a
dist/directory during the Docker image build. The files in/app/distinside a running container are compiled artifacts and are not the authoritative source. - Do not edit files inside running containers. Changes made directly inside a container are ephemeral and will be overwritten the next time you rebuild the image or recreate the container.
- To apply changes, edit the true source files (for the backend
server/src/, for the frontendclient/src/) and rebuild/restart the appropriate container(s):
# Rebuild server image and start it
docker-compose up -d --build server
# Or restart after code changes
docker-compose restart server
# Inspect compiled output in a running server container
docker exec the-beans-server-1 ls -la /app/dist- Recommended CI check: add a job that runs
npm run buildin theserver(and optionallyclient) package to ensure TypeScript builds succeed on pull requests. This prevents mismatches betweensrc/and compileddist/artifacts.
- Container won't start: Check Docker Desktop is running
- Database connection fails: Ensure PostgreSQL container is healthy
- API calls fail: Verify backend container is running on port 5000
- Changes not visible: Restart the appropriate container
- Admin access needed: Use
admin@example.com/admin123
- Frontend: http://localhost:3000
- Backend: http://localhost:5000
- API Docs: http://localhost:5000/api-docs
- Admin Panel: http://localhost:3000/admin
MIT License - see LICENSE file for details.
- Email: support@the-beans.app
- Issues: GitHub Issues
- Documentation: ./docs/
- Setup Help: SETUP.md