A complete full-stack development environment with Docker orchestration, featuring a NestJS backend, React frontend, and PostgreSQL database.
# Clone the repository
git clone <your-repo-url>
cd nestjs-postgres-docker
# Complete setup (builds, installs dependencies, and starts all services)
make setup
That's it! Your development environment is ready.
- Framework: NestJS with TypeScript
- Database: PostgreSQL with TypeORM
- Features:
- Organized folder structure (entities, modules, DTOs, services, controllers)
- User CRUD API with validation
- CORS enabled for frontend communication
- Auto-schema generation in development
- Framework: React with TypeScript
- Features: Live reloading, modern UI components
- Version: PostgreSQL 15 Alpine
- Features: Persistent data storage, auto-initialization
- Docker Compose: Multi-container orchestration
- Makefile: Automated development commands
- Live Reloading: Both frontend and backend
- Volume Mounting: Local development with container execution
make setup # Complete development environment setup
make up # Start all services
make down # Stop all services
make restart # Restart all services
make build # Build all services
make status # Check container status
make install [service] # Install dependencies (backend|frontend)
make shell [service] # Open shell (backend|frontend|postgres)
make logs [service] # View logs (backend|frontend|postgres)
make logs-follow [service] # Follow logs in real-time
make clean # Remove containers and volumes
- Backend API: http://localhost:3000
- Frontend: http://localhost:3001
- PostgreSQL: localhost:5432
├── backend/ # NestJS backend
│ ├── src/
│ │ ├── config/ # Configuration files
│ │ ├── database/ # Database configuration
│ │ ├── entities/ # TypeORM entities
│ │ ├── modules/ # Feature modules
│ │ │ └── users/ # User module
│ │ │ ├── controllers/
│ │ │ ├── services/
│ │ │ └── dto/
│ │ └── common/ # Shared utilities
│ ├── Dockerfile
│ └── package.json
├── frontend/ # React frontend
│ ├── src/
│ ├── Dockerfile
│ └── package.json
├── docker-compose.yml # Multi-container orchestration
├── Makefile # Development automation
└── README.md
GET /users
- List all usersGET /users/:id
- Get user by IDPOST /users
- Create new userPUT /users/:id
- Update userDELETE /users/:id
- Delete user
# Create a user
curl -X POST http://localhost:3000/users \
-H "Content-Type: application/json" \
-d '{"name": "John Doe", "email": "john@example.com"}'
# Get all users
curl http://localhost:3000/users
- Backend: Node.js 18 Alpine with NestJS
- Frontend: Node.js 18 Alpine with React
- Database: PostgreSQL 15 Alpine
- Networking: Custom bridge network
- Volumes: Persistent data and live code mounting
- CORS: Configured for frontend communication
- SELinux: Compatible with
:Z
volume flags - Environment Variables: Secure configuration management
- Start Development:
make setup
- Make Changes: Edit code in your IDE
- View Changes: Services auto-reload
- Debug: Use
make logs [service]
ormake shell [service]
- Stop:
make down
- NestJS framework
- TypeORM for database
- PostgreSQL driver
- Class-validator for DTOs
- Class-transformer for data transformation
- React with TypeScript
- Modern development tools
- Fork the repository
- Create a feature branch
- Make your changes
- Test with
make setup
- Submit a pull request
This project is open source and available under the MIT License.
Built with ❤️ using modern development practices and Docker orchestration.