- ✨ Introduction
- ⚙️ Tech Stack
- 🔋 Features
- 🤸 Quick Start
Master DevOps by taking an API from code to production with Docker, Kubernetes, Git & GitHub, Warp, and CI/CD Actions! Build a scalable backend using Node.js, Express.js, Neon Postgres, and Drizzle ORM, while testing ensures reliability at every step. Learn to containerize services, orchestrate deployments, automate pipelines, and monitor applications—perfect for developers who want hands-on experience shipping robust, production-ready systems.
-
Arcjet is a developer-first security layer that enables you to protect your applications with minimal code. It offers features like bot protection, rate limiting, email validation, and defense against common attacks. Arcjet's SDK integrates seamlessly into your application, providing real-time security decisions without the need for additional infrastructure.
-
Docker is a leading containerization platform that allows you to package applications along with all their dependencies into portable, lightweight containers. This ensures consistent behavior across different environments, simplifies deployment, and makes scaling applications more efficient.
-
Kubernetes is an open-source orchestration system designed to automate the deployment, scaling, and management of containerized applications. It handles tasks like load balancing, self-healing, and rolling updates, making it essential for running applications reliably at scale.
-
Warp is a modern terminal built in Rust, optimized for developer productivity. It offers features like AI-assisted commands, easy collaboration, command history search, and a faster, more intuitive interface compared to traditional terminals.
-
Node.js is a fast, event-driven JavaScript runtime built on Chrome’s V8 engine. It enables developers to build scalable, high-performance server-side applications and APIs using JavaScript on both the client and server side.
-
Express.js is a minimal and flexible Node.js web application framework. It provides robust features for building APIs and server-side applications, including routing, middleware support, and simplified request/response handling.
-
Neon Postgres is a fully managed, serverless Postgres database designed for modern cloud applications. It offers autoscaling, branching for development workflows, and simplifies database management without compromising performance.
-
Drizzle ORM is a TypeScript-first, lightweight ORM for SQL databases. It provides type safety, schema migrations, and an intuitive API for building reliable and maintainable database queries.
-
Zod is a TypeScript-first schema validation library that ensures runtime type safety. It helps developers validate data structures, enforce strict type checks, and catch errors early in the development process.
👉 Absolute Imports: Clean import paths using # prefix aliases for more organized and readable code.
👉 Business Listings: Create, update, delete, and browse business listings efficiently.
👉 Database Integration: Integrate PostgreSQL with Drizzle ORM, including migrations for schema management.
👉 Deal Management: Create deals on listings, accept or reject offers, and track deal status.
👉 Docker Support: Full containerization with development and production environments for consistent deployment.
👉 ESLint + Prettier: Enforce code linting and formatting rules for cleaner, consistent code.
👉 Health Monitoring: Endpoint to check system health and monitor overall application status.
👉 Hot Reload: Development server automatically restarts on file changes for faster iteration.
👉 Jest Testing: Framework for unit and integration testing with SuperTest for HTTP endpoints.
👉 Request Validation: Validate all API inputs using Zod schemas to ensure data integrity.
👉 Role-Based Access Control: Implement admin and user roles with permission middleware for secure operations.
👉 Structured Logging: Winston-based logging throughout the application for better monitoring and debugging.
👉 User Authentication & Authorization: JWT-based authentication supporting signup, signin, and signout workflows.
👉 User Management: CRUD operations for user accounts, enabling easy administration and management.
And many more, including code architecture and reusability.
Follow these steps to set up the project locally on your machine.
Prerequisites
Make sure you have the following installed on your machine:
- Git
- Node.js
- npm (Node Package Manager)
- Docker & Docker Compose
Cloning the Repository
git clone https://github.com/aswazone/wrapjet-prod-scale-api.git
cd wrapjet-prod-scale-apiThis project supports two deployment modes: Development (with Neon Local) and Production (with Neon Cloud).
Use Neon Local to run a local PostgreSQL instance that simulates Neon's serverless database for development.
1. Set Up Environment Variables
The .env.development file is already configured for local development:
# Server configuration
PORT=3000
NODE_ENV=development
LOG_LEVEL=debug
# Database configuration - Neon Local (Docker Compose)
DATABASE_URL=postgres://postgres:postgres@neon-local:5432/wrapjet_dev2. Start Development Environment
Run the application with Neon Local using Docker Compose:
docker-compose -f docker-compose.dev.yml up --buildThis will:
- Start Neon Local (PostgreSQL) on
localhost:5432 - Start the application on
localhost:3000 - Enable hot-reload for development
3. Run Database Migrations
Once the containers are running, execute migrations:
docker-compose -f docker-compose.dev.yml exec app npm run db:migrate4. (Optional) Access Drizzle Studio
To manage your database visually with Drizzle Studio:
docker-compose -f docker-compose.dev.yml --profile tools up drizzle-studioAccess Drizzle Studio at: http://localhost:4983
5. Stop Development Environment
docker-compose -f docker-compose.dev.yml downTo remove volumes (database data):
docker-compose -f docker-compose.dev.yml down -vFor production, the application connects to Neon Cloud (serverless PostgreSQL).
1. Set Up Environment Variables
Update .env.production with your Neon Cloud database URL:
# Server configuration
PORT=3000
NODE_ENV=production
LOG_LEVEL=info
# Database configuration - Neon Cloud (Production)
DATABASE_URL=postgres://user:password@ep-example-123456.us-east-2.aws.neon.tech/wrapjet_prod?sslmode=require
⚠️ Security Note: In production, injectDATABASE_URLvia environment variables from your secrets manager (AWS Secrets Manager, Kubernetes Secrets, etc.). Never commit production credentials to version control.
2. Start Production Environment
Export your production database URL and start the application:
Linux/macOS:
export DATABASE_URL="your-neon-cloud-database-url"
docker-compose -f docker-compose.prod.yml up --build -dWindows (PowerShell):
$env:DATABASE_URL="your-neon-cloud-database-url"
docker-compose -f docker-compose.prod.yml up --build -d3. Run Database Migrations
docker-compose -f docker-compose.prod.yml exec app npm run db:migrate4. Monitor Logs
docker-compose -f docker-compose.prod.yml logs -f app5. Stop Production Environment
docker-compose -f docker-compose.prod.yml downIf you prefer to run the application without Docker:
Installation
Install the project dependencies using npm:
npm installSet Up Environment Variables
Create a new file named .env in the root of your project and add the following content:
# Server Configuration
PORT=3000
NODE_ENV=development
LOG_LEVEL=info
# Database Configuration
DATABASE_URL=
# Arcjet
ARCJET_KEY=Replace the placeholder values with your real credentials. You can get these by signing up at: Arcjet, Neon.
Running the Project
npm run devOpen http://localhost:3000 in your browser to view the project.
View Running Containers
docker psAccess Application Shell
# Development
docker-compose -f docker-compose.dev.yml exec app sh
# Production
docker-compose -f docker-compose.prod.yml exec app shView Application Logs
# Development
docker-compose -f docker-compose.dev.yml logs -f app
# Production
docker-compose -f docker-compose.prod.yml logs -f appRebuild Containers
# Development
docker-compose -f docker-compose.dev.yml up --build
# Production
docker-compose -f docker-compose.prod.yml up --buildGenerate Migrations
npm run db:generateRun Migrations
# Development
docker-compose -f docker-compose.dev.yml exec app npm run db:migrate
# Production
docker-compose -f docker-compose.prod.yml exec app npm run db:migrateOpen Drizzle Studio
npm run db:studio| Variable | Description | Development | Production |
|---|---|---|---|
NODE_ENV |
Environment mode | development |
production |
PORT |
Application port | 3000 |
3000 |
LOG_LEVEL |
Logging verbosity | debug |
info |
DATABASE_URL |
PostgreSQL connection string | Neon Local | Neon Cloud |
ARCJET_KEY |
Arcjet API key | Your dev key | Your prod key |
- Automatically started via
docker-compose.dev.yml - Runs PostgreSQL locally in a Docker container
- Simulates Neon's serverless database features
- Data persists in Docker volumes
- Learn more: Neon Local Documentation
- Fully managed serverless PostgreSQL
- Sign up at: Neon
- Create a project and database
- Copy your connection string to
.env.production - Supports autoscaling, branching, and point-in-time recovery
Follow Aswazone on GitHub for more projects simillar to this.