Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

MarvinAmine/turbovets-dashboard

Repository files navigation

TurboVets Monorepo

TurboVets is a monorepo project built with NestJS, TypeORM, Postgres, Redis, and an Angular dashboard.
This guide will help you set up the development environment quickly.


πŸ“¦ Requirements

Make sure you have the following installed:

  • Docker (>= 20.10)
  • Docker Compose (v2 recommended)
  • Node.js (>= 20.x) and npm (>= 10.x) β€” required only if you want to run commands outside Docker
  • psql client (optional, for inspecting the DB directly)

πŸš€ Getting Started

1. Clone the repository

git clone <your-repo-url>
cd TurboVets

2. Copy .env file

cp .env.example .env

You can tweak DATABASE_URL, REDIS_URL, and secrets inside .env.


🐳 Running with Docker (recommended)

Start all services (API, DB, Redis, Dashboard):

docker compose -f docker-compose.yml up -d --build

Stop all services:

docker compose -f docker-compose.yml down -v

Check logs for the API:

docker compose -f docker-compose.yml logs -f api-dev

Check logs for the Dashboard:

docker compose -f docker-compose.yml logs -f dashboard-dev

πŸ§‘β€πŸ’» Running Locally (without Docker)

You can run the backend with hot-reload outside Docker while keeping Postgres + Redis in containers.

.env.dev
# DEV
NODE_ENV=development
PORT=3000
JWT_SECRET=change-me-dev

# Postgres
POSTGRES_DB=turbovets
POSTGRES_USER=turbovets
POSTGRES_PASSWORD=turbovets

# Local DB + Redis (via Docker Compose)
DATABASE_URL=postgres://turbovets:turbovets@localhost:5433/turbovets
REDIS_URL=redis://localhost:6380

1. Start DB + Redis only

docker compose -f docker-compose.yml up db redis -d

2. Install dependencies

npm install

3. Run the API (NestJS)

Run the backend

npx ts-node-dev -r tsconfig-paths/register -P tsconfig.dev.json apps/api/src/main.ts 

The API will be available at http://localhost:3000.

4. Run the Dashboard (Angular)

npm run start

The Angular dev server will be available at http://localhost:4200.


πŸ—„ Database & Migrations

Automatic Migration

On startup, the api-dev container will automatically run pending migrations.

Manual Migration Commands

Generate a new migration after changing entities:

docker compose -f docker-compose.yml exec api-dev \
  npx ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js \
  migration:generate -d apps/api/src/typeorm.config.ts apps/api/src/migrations/<migration-name>

Run migrations:

docker compose -f docker-compose.yml run --rm api-dev \
  npx ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js \
  migration:run -d apps/api/src/typeorm.config.ts

Inspect migrations applied:

docker exec -it turbovets_db_dev psql -U turbovets -d turbovets -c "SELECT * FROM migrations;"

🌐 Services


βœ… Run the Tests

From the project root:

npm run test

πŸ”‘ How to Test Endpoints

1. Login

πŸ”‘ Credentials

curl -X POST http://localhost:3001/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "Password123!"}'

Expected response:

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5c..."
}

2. Fetch tasks

curl http://localhost:3001/tasks \
  -H "Authorization: Bearer <access_token_here>"

πŸ›  Troubleshooting

  • Cannot connect to DB? Make sure the container turbovets_db_dev is healthy:

    docker ps --filter "name=turbovets_db_dev"
  • Dashboard shows β€œCannot GET /”? This usually means the Angular build didn’t complete. Try rebuilding:

    docker compose -f docker-compose.yml up -d --build
  • Stuck container? Kill containers with these commands

    chmod +x cleanup-containers.sh
    ./cleanup-containers.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published