Skip to content

Commit 93dba0f

Browse files
committed
align the project with specs
1 parent 841ed0d commit 93dba0f

3 files changed

Lines changed: 154 additions & 105 deletions

File tree

‎.env.example‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
DATABASE_URL=""
2-
SESSION_SECRET=""
3-
REPL_ID=""
4-
API_PROD_URL=""
1+
# Required: at least one of DATABASE_URL (dev) or DATABASE_URL_PROD (prod)
2+
DATABASE_URL="postgresql://user:password@localhost:5432/museum"
3+
# DATABASE_URL_PROD="postgresql://..."
4+
5+
# Required: min 32 characters
6+
SESSION_SECRET="your-super-secret-session-key-at-least-32-chars"
7+
8+
# Server
9+
PORT=5001
10+
NODE_ENV=development
11+
12+
# CORS: allowed origin for browser requests (default http://localhost:3000)
13+
FRONTEND_URL="http://localhost:3000"
14+
# Optional: comma-separated extra origins
15+
# CORS_ORIGINS="https://app.example.com,https://admin.example.com"
16+
17+
# Production: set when NODE_ENV=production
18+
# API_PROD_URL="https://api.example.com"
19+
20+
# Optional: Cloudinary (for gallery uploads)
21+
# CLOUDINARY_CLOUD_NAME=
22+
# CLOUDINARY_API_KEY=
23+
# CLOUDINARY_API_SECRET=

‎.github/workflows/ci.yml‎

Lines changed: 130 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,135 @@
11
name: CI
22

33
on:
4-
push:
5-
branches: [main, master, develop]
6-
pull_request:
7-
branches: [main, master, develop]
4+
push:
5+
branches: [main, master, develop]
6+
pull_request:
7+
branches: [main, master, develop]
88

99
jobs:
10-
test:
11-
name: Test and Lint
12-
runs-on: ubuntu-latest
13-
14-
strategy:
15-
matrix:
16-
node-version: [20.x]
17-
18-
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v4
21-
22-
- name: Setup Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v4
24-
with:
25-
node-version: ${{ matrix.node-version }}
26-
27-
- name: Install pnpm
28-
uses: pnpm/action-setup@v4
29-
with:
30-
version: 8
31-
32-
- name: Get pnpm store directory
33-
shell: bash
34-
run: |
35-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
36-
37-
- name: Setup pnpm cache
38-
uses: actions/cache@v4
39-
with:
40-
path: ${{ env.STORE_PATH }}
41-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
42-
restore-keys: |
43-
${{ runner.os }}-pnpm-store-
44-
45-
- name: Install dependencies
46-
run: pnpm install --frozen-lockfile
47-
48-
- name: Run linter
49-
run: pnpm run lint
50-
51-
- name: Type check
52-
run: pnpm run check
53-
54-
- name: Run tests
55-
run: pnpm run test
56-
env:
57-
NODE_ENV: test
58-
59-
- name: Build project
60-
run: pnpm run build
61-
62-
build:
63-
name: Build
64-
runs-on: ubuntu-latest
65-
needs: test
66-
67-
steps:
68-
- name: Checkout code
69-
uses: actions/checkout@v4
70-
71-
- name: Setup Node.js
72-
uses: actions/setup-node@v4
73-
with:
74-
node-version: 20.x
75-
76-
- name: Install pnpm
77-
uses: pnpm/action-setup@v4
78-
with:
79-
version: 8
80-
81-
- name: Get pnpm store directory
82-
shell: bash
83-
run: |
84-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
85-
86-
- name: Setup pnpm cache
87-
uses: actions/cache@v4
88-
with:
89-
path: ${{ env.STORE_PATH }}
90-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
91-
restore-keys: |
92-
${{ runner.os }}-pnpm-store-
93-
94-
- name: Install dependencies
95-
run: pnpm install --frozen-lockfile
96-
97-
- name: Build for production
98-
run: pnpm run build:prod
99-
100-
- name: Upload build artifacts
101-
uses: actions/upload-artifact@v4
102-
with:
103-
name: dist
104-
path: dist/
105-
retention-days: 7
10+
test:
11+
name: Test and Lint
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [20.x]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v4
24+
with:
25+
version: 8
26+
27+
- name: Setup Node.js ${{ matrix.node-version }}
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
cache: "pnpm"
32+
33+
- name: Get pnpm store directory
34+
shell: bash
35+
run: |
36+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
37+
38+
- name: Setup pnpm cache
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ env.STORE_PATH }}
42+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
43+
restore-keys: |
44+
${{ runner.os }}-pnpm-store-
45+
46+
- name: Install dependencies
47+
run: pnpm install --frozen-lockfile
48+
49+
- name: Check formatting
50+
run: pnpm run format:check
51+
52+
- name: Run linter
53+
run: pnpm run lint
54+
55+
- name: Type check
56+
run: pnpm run check
57+
58+
- name: Run tests
59+
run: pnpm run test
60+
env:
61+
NODE_ENV: test
62+
63+
- name: Build project
64+
run: pnpm run build
65+
66+
build:
67+
name: Build
68+
runs-on: ubuntu-latest
69+
needs: test
70+
71+
steps:
72+
- name: Checkout code
73+
uses: actions/checkout@v4
74+
75+
- name: Install pnpm
76+
uses: pnpm/action-setup@v4
77+
with:
78+
version: 8
79+
80+
- name: Setup Node.js
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: 20.x
84+
cache: "pnpm"
85+
86+
- name: Get pnpm store directory
87+
shell: bash
88+
run: |
89+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
90+
91+
- name: Setup pnpm cache
92+
uses: actions/cache@v4
93+
with:
94+
path: ${{ env.STORE_PATH }}
95+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
96+
restore-keys: |
97+
${{ runner.os }}-pnpm-store-
98+
99+
- name: Install dependencies
100+
run: pnpm install --frozen-lockfile
101+
102+
- name: Prepare for build
103+
run: pnpm run prebuild
104+
105+
- name: Build for production
106+
run: pnpm run build:prod
107+
108+
- name: Upload build artifacts
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: dist
112+
path: dist/
113+
retention-days: 7
114+
115+
docker:
116+
name: Docker build
117+
runs-on: ubuntu-latest
118+
needs: test
119+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
120+
steps:
121+
- name: Checkout code
122+
uses: actions/checkout@v4
123+
124+
- name: Set up Docker Buildx
125+
uses: docker/setup-buildx-action@v3
126+
127+
- name: Build Docker image
128+
uses: docker/build-push-action@v6
129+
with:
130+
context: .
131+
push: false
132+
load: true
133+
tags: museum-management-rest-api:latest
134+
cache-from: type=gha
135+
cache-to: type=gha,mode=max

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ logs
88
config/database/reset-db.ts
99
todo-tasks.md
1010
config/database/seed.ts
11-
config/database/badagry_backend.code-workspace.json
11+
config/database/museum-management.code-workspace*
1212
.DS_Store
1313
*.swp
1414
*.swo

0 commit comments

Comments
 (0)