Skip to content

Digital-Pathshala/Vpn-Microservices

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VPN Backend (Microservices)

NestJS (Prisma) + Go (sqlc) + PostgreSQL, runnable with Docker Compose.

Stack

Service Tech Role
api NestJS + Prisma REST API, auth, CRUD
vpn Go + sqlc VPN logic, config, high concurrency
postgres PostgreSQL 16 Shared database

Quick start

# From repo root (backend/)
cp .env.example .env
docker compose up -d

# API: http://localhost:3000
# VPN: http://localhost:8080
# Health: GET /health on each

Project layout

backend/
├── docker-compose.yml      # postgres + api + vpn
├── .env.example
├── services/
│   ├── api/                # NestJS + Prisma
│   │   ├── Dockerfile
│   │   ├── prisma/
│   │   │   ├── schema.prisma
│   │   │   └── migrations/
│   │   └── src/
│   └── vpn/                # Go + sqlc
│       ├── Dockerfile
│       ├── sqlc.yaml
│       ├── db/
│       │   ├── schema/     # SQL schema (keep in sync with Prisma)
│       │   └── queries/
│       ├── internal/db/    # sqlc-generated (run `sqlc generate`)
│       └── cmd/server/
└── README.md

Local dev (without Docker)

Postgres

docker compose up -d postgres
# DATABASE_URL=postgresql://vpn:vpn_secret@localhost:5432/vpn_db

API (NestJS)

cd services/api
cp ../../.env.example .env   # or set DATABASE_URL
npm install
npx prisma migrate dev
npm run start:dev

VPN (Go)

cd services/vpn
# Install sqlc: go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
sqlc generate   # after changing db/queries or db/schema
go run ./cmd/server

Schema sync

  • Prisma (NestJS) owns migrations: edit services/api/prisma/schema.prisma, then npx prisma migrate dev.
  • sqlc (Go) needs matching SQL: keep services/vpn/db/schema/*.sql in sync with Prisma (or export from DB with pg_dump --schema-only and point sqlc at that).

Commands

Task Command
Start all docker compose up -d
Build all docker compose build
Logs docker compose logs -f api or vpn
Stop docker compose down

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 85.6%
  • Assembly 13.0%
  • TypeScript 0.7%
  • Shell 0.5%
  • C 0.2%
  • Dockerfile 0.0%