This is a Next.js project for the Astronautics Club website, containerized with Docker and Nginx.
- Next.js frontend and backend
- Nginx as a reverse proxy
- Persistent storage for uploaded media files
- Environment-based configuration
- Docker and Docker Compose installed on your system
-
Build and start the containers:
docker-compose up -d
Or use the provided Makefile:
make start
-
Access the application:
- Website: http://localhost
- API endpoints: http://localhost/api/...
All uploaded files are stored in a Docker volume (uploads_data), ensuring that:
- Files persist between container restarts
- Files are not lost during application updates
- Both Next.js and Nginx can access the uploaded files
Logs are also stored in a Docker volume (logs_data) for persistence.
The project includes a Makefile for easier management of Docker containers and data operations:
# Show all available commands
make help
# Production commands
make build # Build production containers
make start # Start production environment
make stop # Stop production environment
make logs # View production logs
# Development commands
make build-dev # Build development containers
make start-dev # Start development environment
make stop-dev # Stop development environment
make logs-dev # View development logs
# Data management
make download-uploads # Download uploads as ZIP
make upload-to-volume SOURCE=./files # Upload files to volume
make backup-uploads # Backup uploads volume
make restore-uploads FILE=path/to.zip # Restore uploads from backup
make backup-logs # Backup logs volume
make restore-logs FILE=path/to.zip # Restore logs from backupFirst, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
The application includes an API for file uploads with the following endpoints:
-
POST /api/upload: Upload a new file- Expected form data:
file(the file to upload) - Returns: JSON with file details and URL
- Expected form data:
-
GET /api/upload: List all uploaded files- Returns: JSON with array of file details
-
GET /api/upload?filename=example.jpg: Get details of a specific file- Returns: JSON with file details
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!