Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a0ad203
Containerized api with production data seeding script enabled
shrutiiiyet Mar 27, 2026
0e71d9d
implemented rabbit's recommendations
shrutiiiyet Mar 28, 2026
56e3d95
Added static seed
shrutiiiyet Mar 28, 2026
2556b39
optimized image
shrutiiiyet Mar 29, 2026
780a51a
made api file production optimized
shrutiiiyet Mar 31, 2026
fc4aa9a
Merge pull request #69 from call-0f-code/local-setup
i-am-that-guy Apr 1, 2026
52b940c
update schema
Harish-Naruto Jun 16, 2026
29ffade
add Client util to avoid Parameter Tunneling
Harish-Naruto Jun 16, 2026
6955f6b
add service to support dynamic site content
Harish-Naruto Jun 16, 2026
6206abe
fix server Api doc rendering and path
Harish-Naruto Jun 16, 2026
26ea8a8
Site content test
Harish-Naruto Jun 16, 2026
0a123f4
change supabase client
Harish-Naruto Jun 16, 2026
5130843
change test to support supabase client
Harish-Naruto Jun 16, 2026
ed5acdb
fix double delete
Harish-Naruto Jun 16, 2026
0fac966
feat: add EmailTemplate model and CRUD endpoints for managing email t…
Harish-Naruto Jun 16, 2026
6cc634b
Merge pull request #70 from call-0f-code/new-feature
callofcode07 Jun 16, 2026
4cc4808
Merge pull request #71 from call-0f-code/feature/dynamic-email
callofcode07 Jun 16, 2026
95e700b
change updateRequest to support isApproved == false
Harish-Naruto Jun 16, 2026
b617d63
feat: replace isManager boolean with Role enum and implement restrict…
Harish-Naruto Jun 16, 2026
240cf37
Merge pull request #72 from call-0f-code/feature/SuperAdmin
callofcode07 Jun 16, 2026
de1689d
feat: add ghosting functionality to hide members from public lists an…
Harish-Naruto Jun 16, 2026
06e9c2a
removed unused import
Harish-Naruto Jun 16, 2026
f35d8e9
Update src/services/member.service.ts
Harish-Naruto Jun 18, 2026
b796396
res updated
Harish-Naruto Jun 18, 2026
7c2ac0b
fix member test
Harish-Naruto Jun 18, 2026
f2fdf51
Merge pull request #73 from call-0f-code/feature/ghost-request
callofcode07 Jun 18, 2026
3189dd9
docs: update README with project structure, setup instructions, and s…
Harish-Naruto Jun 18, 2026
6cae6e6
Merge pull request #74 from call-0f-code/fix/doc
callofcode07 Jun 18, 2026
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
81 changes: 81 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Dependencies
node_modules
bun.lockb

# Build outputs
dist
build
.next

# Environment files
.env
.env.local
.env.*.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
bun-debug.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage
*.lcov

# IDE files
.vscode
.idea
*.swp
*.swo

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Git
.git
.gitignore

# Docker
Dockerfile*
docker-compose*
.dockerignore

# Documentation and README
README.md
*.md
docs

# Test files
tests
__tests__
*.test.ts
*.test.js
*.spec.ts
*.spec.js

# Development tools
.eslintrc*
.prettierrc*
jest.config*
tsconfig*.json

# Prisma migrations
# prisma/migrations

# Temporary files
tmp
temp
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ DIRECT_URL=
# Supabase URL
SUPABASE_URL=

# Session-mode pooler URL — used by setup-local.sh for pg_dump (IPv4-accessible).
SESSION_POOLER=

# Supabase service role key
SUPABASE_SERVICE_ROLE_KEY=

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
Expand Down
55 changes: 55 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM oven/bun:1.3 AS base
WORKDIR /var/www/api

# -----------------------------
# deps stage - cache dependencies
# -----------------------------
FROM base AS deps

COPY package.json bun.lock* ./
COPY prisma ./prisma
RUN bun install --frozen-lockfile
RUN bunx prisma generate

# -----------------------------
# build stage - compile TypeScript to JavaScript
# -----------------------------
FROM deps AS build

COPY . .
RUN bun build src/server.ts --target=bun --production --outdir dist

# -----------------------------
# development stage
# -----------------------------
FROM deps AS development
COPY . .
EXPOSE 3000
CMD ["bun", "src/server.ts"]

# -----------------------------
# production stage
# -----------------------------


FROM oven/bun:1-slim AS production

WORKDIR /var/www/api
RUN groupadd -g 1001 nodejs && useradd -u 1001 -g nodejs -m bunjs

COPY --from=build --chown=bunjs:nodejs /var/www/api/dist ./dist
COPY --from=deps --chown=bunjs:nodejs /var/www/api/src/generated ./dist/generated


RUN chown -R bunjs:nodejs /var/www/api
USER bunjs

ENV NODE_ENV=production
ENV PORT=3000

EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost:3000/health || exit 1

CMD ["bun", "./dist/server.js"]
54 changes: 54 additions & 0 deletions LOCAL_DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Local Development Environment Setup

This document explains how to set up and manage the local development environment for the COC-API project.

## Prerequisites

- **Docker & Docker Compose**: Ensure you have Docker installed and running.
- **PostgreSQL Client (`pg_dump`)**: Optional. The current local setup prefers loading a local `seed/dump.sql` file. `pg_dump` is only required if you want to create a fresh dump from a remote database manually.

## Setup Instructions

### 1. Configure Environment Variables

Copy the `.env.example` file to `.env` and fill in the required values:

```bash
cp .env.example .env
```

Key variables for the setup script:
- `SESSION_POOLER`: The direct connection string to your Supabase project (Session Pooler / IPv4).
- **Format**: `postgresql://postgres.PROJECT_REF:PASSWORD@aws-0-us-east-1.pooler.supabase.com:5432/postgres`

### 2. Run the Setup Script

The `scripts/setup-local.sh` script automates the local environment bring-up. By default it will load the local `seed/dump.sql` into the local Postgres instance.

```bash
bun run local
```

#### What the script does:
1. **Starts Postgres**: Launches the `db` container.
2. **Installs Extensions**: Pre-installs `pgcrypto`, `uuid-ossp`, and `pg_stat_statements` into the `public` schema.
3. **Loads Local Seed**: The script will attempt to load `seed/dump.sql` into the DB only when there are no existing user tables present in the database. If the database already contains tables (non-system tables), the seed step will be skipped to avoid accidentally overwriting existing data. This is the default and recommended local flow.
4. **Starts the API**: Launches the `api` container and waits for it to be healthy.

Flags:
- `--skip-dump`: reuse existing `seed/dump.sql` (no remote dump step)
- `--skip-seed`: skip loading the seed and just start containers

### 3. Useful Commands

- **Start environment**: `bash scripts/setup-local.sh`
- **Skip dump (reuse existing `seed/dump.sql`)**: `bash scripts/setup-local.sh --skip-dump`
- **Skip seeding (just start containers)**: `bash scripts/setup-local.sh --skip-seed`
- **View logs**: `docker compose logs -f`
- **Stop containers**: `docker compose down`
- **Wipe local data (force re-seed)**: `docker compose down -v`

## Troubleshooting

### Tables not in `public` schema
The script automatically patches the dump to ensure tables are placed in the `public` schema. If you manually imported a dump, ensure you've installed the required extensions first.
Loading
Loading