Skip to content

scottsdevelopment/agentic-nestjs-react-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NestJS + React + PostgreSQL Docker Development Environment

A complete full-stack development environment with Docker orchestration, featuring a NestJS backend, React frontend, and PostgreSQL database.

🚀 Quick Start

# 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.

📋 What's Included

Backend (NestJS)

  • 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

Frontend (React)

  • Framework: React with TypeScript
  • Features: Live reloading, modern UI components

Database (PostgreSQL)

  • Version: PostgreSQL 15 Alpine
  • Features: Persistent data storage, auto-initialization

Development Tools

  • Docker Compose: Multi-container orchestration
  • Makefile: Automated development commands
  • Live Reloading: Both frontend and backend
  • Volume Mounting: Local development with container execution

🛠️ Available Commands

One-Command Setup

make setup           # Complete development environment setup

Core Commands

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

Development Commands

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

Utility Commands

make clean           # Remove containers and volumes

🌐 Service URLs

📁 Project Structure

├── 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

🔧 API Endpoints

Users

  • GET /users - List all users
  • GET /users/:id - Get user by ID
  • POST /users - Create new user
  • PUT /users/:id - Update user
  • DELETE /users/:id - Delete user

Example API Usage

# 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

🐳 Docker Configuration

  • 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

🔒 Security Features

  • CORS: Configured for frontend communication
  • SELinux: Compatible with :Z volume flags
  • Environment Variables: Secure configuration management

🚀 Development Workflow

  1. Start Development: make setup
  2. Make Changes: Edit code in your IDE
  3. View Changes: Services auto-reload
  4. Debug: Use make logs [service] or make shell [service]
  5. Stop: make down

📦 Dependencies

Backend

  • NestJS framework
  • TypeORM for database
  • PostgreSQL driver
  • Class-validator for DTOs
  • Class-transformer for data transformation

Frontend

  • React with TypeScript
  • Modern development tools

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with make setup
  5. Submit a pull request

📄 License

This project is open source and available under the MIT License.


Built with ❤️ using modern development practices and Docker orchestration.

About

Agent AI + NestJS + React + PostgreSQL Development Template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published