Skip to content
Open
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
67 changes: 67 additions & 0 deletions .github/workflows/api-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: API CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'

- name: Install dependencies
run: |
cd api
npm install

test:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'

- name: Install dependencies
run: |
cd api
npm install

- name: Run tests
run: |
cd api
npm test

lint:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'

- name: Install dependencies
run: |
cd api
npm install

- name: Run linter
run: |
cd api
npm run lint
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A production-ready setup for building Vue 3 applications with TypeScript, testin
## Features

- **Frontend:** Vue 3, TypeScript, Vite
- **API:** Node.js, TypeORM
- **Testing:** Vitest, Testing Library, Jest DOM
- **Code Quality:** ESLint, Prettier
- **Docker:** Multi-stage Dockerfile for production builds
Expand Down Expand Up @@ -34,6 +35,7 @@ A production-ready setup for building Vue 3 applications with TypeScript, testin
Each project manages its own dependencies:
```bash
cd frontend && npm install
cd api && npm install
```

### Available Scripts
Expand All @@ -49,11 +51,15 @@ cd frontend && npm install
```bash
# Terminal 1 (frontend)
cd frontend && npm run dev

# Terminal 2 (frontend)
cd api && npm run start
```

Access locally:

- Frontend → http://localhost:${FRONTEND_DEV_PORT:-5173}
- API → http://localhost:${NODE_API_PORT:-5000}
- Backend →
- Swagger UI →

Expand All @@ -67,6 +73,10 @@ Before committing code, make sure files are linted and formatted:
# Format & lint frontend
cd frontend && npm run lint
cd frontend && npm run lint:fix

# Format & lint api
cd api && npm run pretest
cd api && npm run lint
```

⚡ Husky + lint-staged will auto-run these checks on staged files during commits.
Expand Down Expand Up @@ -122,6 +132,7 @@ docker compose up -d --build
Access locally via docker:

- Frontend → http://localhost:${FRONTEND_DEV_PORT:-8080}
- API → http://localhost:${NODE_API_PORT:-5000}
- Backend →
- Swagger UI →

Expand Down
9 changes: 9 additions & 0 deletions api/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DB_HOST=localhost
DB_USERNAME=postgres
DB_PASSWORD='Aot123#'
DB_DATABASE=postgres
DB_SCHEMA=public
DB_PORT=5432
PORT=5000
ALLOWED_ORIGINS="['http://localhost:3000']"
LOG_LEVEL=info
8 changes: 8 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea/
.vscode/
node_modules/
build/
tmp/
temp/
coverage/
logs/
1 change: 1 addition & 0 deletions api/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v24.4.0
19 changes: 19 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:24.4.0-alpine

# install dependencies
WORKDIR /app
COPY /api/package.json ./

RUN npm cache clean --force && npm install && \
npm install -g npm-check-updates

# copy app source to image _after_ npm install so that
# application code changes don't bust the docker cache of npm install step
COPY /api/. /app


# set application PORT and expose docker PORT, 80 is what Elastic Beanstalk expects
ENV PORT 5000
EXPOSE 5000

CMD ["sh","-c","npm run typeorm migration:run -- -d src/connections/db.ts && npm start"]
9 changes: 9 additions & 0 deletions api/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import neostandard from 'neostandard';

export default tseslint.config(
...neostandard(),
eslint.configs.recommended,
tseslint.configs.recommended
);
15 changes: 15 additions & 0 deletions api/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
roots: [
'src'
],
testEnvironment: 'node',
testTimeout: 30000,
preset: 'ts-jest',
transform: {
'^.+\\.ts?$': 'ts-jest'
},
collectCoverage: true,
coverageDirectory: 'coverage'
}
28 changes: 28 additions & 0 deletions api/ormconfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// eslint-disable-next-line @typescript-eslint/no-require-imports
require('dotenv').config()

module.exports = {
type: 'postgres',
host: process.env.DB_HOST,
port: process.env.DB_PORT,
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
schema: process.env.DB_SCHEMA,
synchronize: false,
logging: false,
entities: [
'src/entities/**/*.ts'
],
migrations: [
'src/migration/**/*.ts'
],
subscribers: [
'src/subscriber/**/*.ts'
],
cli: {
entitiesDir: 'src/entities',
migrationsDir: 'src/migration',
subscribersDir: 'src/subscriber'
}
}
Loading