Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
.env
.git
*.log
23 changes: 23 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:24-alpine

WORKDIR /app

# Doppler CLI so we can run `doppler run --` inside the container
RUN apk add --no-cache curl gnupg \
&& curl -Ls https://cli.doppler.com/install.sh | sh

# pnpm via corepack (ships with node 24, no separate install needed)
RUN corepack enable && corepack prepare pnpm@latest --activate

COPY package.json pnpm-lock.yaml ./
COPY prisma ./prisma

RUN pnpm install

COPY . .

RUN pnpm exec prisma generate

EXPOSE 3000

CMD ["pnpm", "dev"]
49 changes: 49 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: guidway
POSTGRES_PASSWORD: guidway
POSTGRES_DB: guidway
ports:
- "5434:5432"
volumes:
- pgdata:/var/lib/postgresql/data

redis:
image: redis:7-alpine
ports:
- "6380:6379"

backend:
build:
context: .
dockerfile: Dockerfile.dev
environment:
DOPPLER_TOKEN: ${DOPPLER_TOKEN}
volumes:
- .:/app
- /app/node_modules
ports:
- "3000:3000"
depends_on:
- postgres
- redis

volumes:
pgdata:

# services:
# backend:
# build:
# context: .
# dockerfile: Dockerfile.dev
# environment:
# DOPPLER_TOKEN: ${DOPPLER_TOKEN}
# extra_hosts:
# - "host.docker.internal:host-gateway"
# volumes:
# - .:/app
# - /app/node_modules
# ports:
# - "3000:3000"
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class CreateBookingIntentUsecase implements ICreateBookingIntentUsecase {
data.startTime,
data.endTime,
);

console.log("mentor vailable", availability);
if (!availability) {
throw new ConflictError("Mentor is unavailable for the requested time");
}
Expand Down
5 changes: 5 additions & 0 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { z } from "zod";

const envSchema = z.object({
DATABASE_URL: z.url("DATABASE_URL must be a valid connection string"),
REDIS_URL: z.url("Redis url must be a valid connection string"),

NODE_ENV: z
.enum(["development", "production", "test"])
.default("development"),
Expand Down Expand Up @@ -57,6 +59,9 @@ export class EnvConfig {
static get NODE_ENV(): string {
return parsedEnv.NODE_ENV;
}
static get REDIS_URL(): string {
return parsedEnv.REDIS_URL;
}
static get RAZORPAY_KEY_ID(): string {
return parsedEnv.RAZORPAY_KEY_ID;
}
Expand Down
3 changes: 2 additions & 1 deletion src/infrastructure/database/redisClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EnvConfig } from "@config/env";
import { createClient } from "redis";

export const redisClient = createClient();
export const redisClient = createClient({ url: EnvConfig.REDIS_URL });

redisClient.on("error", (err) => console.error("Redis Client Error", err));
redisClient.on("connect", () =>
Expand Down
2 changes: 1 addition & 1 deletion src/presentation/controllers/booking/booking.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class BookingController implements IBookingController {
const result = await this._createBookingIntentUsecase.execute(userId, data);

res
.status(201)
.status(HTTPSTATUS.CREATED)
.json(createSuccess("Booking intent created successfully", result));
};

Expand Down