A production-ready e-commerce REST API built with NestJS, featuring authentication, product management, file uploads, and real-time messaging capabilities.
# Pull and run the image
docker pull your-registry/teslo-shop:latest
docker run -p 3000:3000 -e PORT=3000 your-registry/teslo-shop:latest
Teslo Shop is a comprehensive e-commerce backend API built with NestJS and TypeScript. It provides a complete solution for online store management with modern web technologies and best practices.
The following environment variables are required to configure the application:
| Variable | Description | Required | Default | Example |
|---|---|---|---|---|
PORT | Application port | ✅ | 3000 | 3000 |
APP_VERSION | Application version for tracking | ❌ | - | 1.0.1 |
STAGE | Deployment stage (affects SSL settings) | ✅ | dev | dev, prod |
DB_HOST | PostgreSQL database host | ✅ | - | localhost, db |
DB_PORT | PostgreSQL database port | ✅ | 5432 | 5432 |
DB_NAME | PostgreSQL database name | ✅ | - | TesloDB |
DB_USERNAME | PostgreSQL database username | ✅ | - | postgres |
DB_PASSWORD | PostgreSQL database password | ✅ | - | MySecr3tPassWord@as2 |
JWT_SECRET | Secret key for JWT token signing | ✅ | - | Est3EsMISE3Dsecreto32s... |
HOST_API | Base URL for API (used for file URLs) | ✅ | - | http://localhost:3000/api |
STAGE=prod, the application automatically enables SSL for database connectionsJWT_SECRET in production (minimum 32 characters recommended)HOST_API is used to generate complete URLs for uploaded files/api/api (Swagger UI)/api/seed (also serves as data seeding endpoint)This image uses a multi-stage Docker build for optimal production deployment:
latest - Latest stable releasedev - Development build with hot reload capabilitiesx.x.x - Specific version tagsdocker run -p 3000:3000 \
-e PORT=3000 \
-e STAGE=dev \
-e DB_HOST=localhost \
-e DB_PORT=5432 \
-e DB_NAME=TesloDB \
-e DB_USERNAME=postgres \
-e DB_PASSWORD=MySecr3tPassWord@as2 \
-e JWT_SECRET=Est3EsMISE3Dsecreto32s \
-e HOST_API=http://localhost:3000/api \
-v $(pwd):/app \
-v /app/node_modules \
your-registry/teslo-shop:dev
docker run -d \
--name teslo-shop \
-p 3000:3000 \
-e PORT=3000 \
-e APP_VERSION=1.0.0 \
-e STAGE=prod \
-e DB_HOST=your-db-host \
-e DB_PORT=5432 \
-e DB_NAME=TesloDB \
-e DB_USERNAME=postgres \
-e DB_PASSWORD=your-secure-password \
-e JWT_SECRET=your-super-secure-jwt-secret-key \
-e HOST_API=https://your-domain.com/api \
your-registry/teslo-shop:latest
version: '3.8'
services:
teslo-shop:
image: your-registry/teslo-shop:latest
ports:
- "3000:3000"
environment:
- PORT=3000
- APP_VERSION=1.0.0
- STAGE=prod
- DB_HOST=postgres
- DB_PORT=5432
- DB_NAME=TesloDB
- DB_USERNAME=postgres
- DB_PASSWORD=MySecr3tPassWord@as2
- JWT_SECRET=Est3EsMISE3Dsecreto32s
- HOST_API=http://localhost:3000/api
depends_on:
- postgres
postgres:
image: postgres:14.3
environment:
- POSTGRES_DB=TesloDB
- POSTGRES_PASSWORD=MySecr3tPassWord@as2
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
volumes:
postgres_data:
# Application Configuration
PORT=3000
APP_VERSION=1.0.1
STAGE=dev
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=TesloDB
DB_USERNAME=postgres
DB_PASSWORD=MySecr3tPassWord@as2
# Security
JWT_SECRET=Est3EsMISE3Dsecreto32s
# API Configuration
HOST_API=http://localhost:3000/api
The application exposes a health check endpoint at /api/seed which can be used to verify the service is running correctly.
The application supports secure file uploads for product images with:
This project is licensed under UNLICENSED.
For issues and questions, please refer to the project repository or contact the development team.
Content type
Image
Digest
sha256:7bac1d97a…
Size
65.6 MB
Last updated
about 1 year ago
docker pull jjimenezc/teslo-shop