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
28 changes: 14 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
}
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ We recommend using [mise](https://mise.jdx.dev/) for managing tool versions. A `

# Or start a specific service
pnpm --filter @atlas/cyclist-profile dev
pnpm --filter @atlas/bicycle-racks dev
```

5. **Building:**
Expand All @@ -68,6 +69,7 @@ We recommend using [mise](https://mise.jdx.dev/) for managing tool versions. A `

# Or build a specific application
pnpm --filter @atlas/cyclist-profile build
pnpm --filter @atlas/bicycle-racks build
```

6. **Testing:**
Expand All @@ -77,6 +79,7 @@ We recommend using [mise](https://mise.jdx.dev/) for managing tool versions. A `

# Or test a specific application
pnpm --filter @atlas/cyclist-profile test
pnpm --filter @atlas/bicycle-racks test
```

7. **Code Quality:**
Expand All @@ -101,7 +104,8 @@ atlas/
β”‚ └── workflows/ # GitHub Actions workflows
β”œβ”€β”€ apps/ # Applications
β”‚ β”œβ”€β”€ docs/ # API documentation site
β”‚ └── cyclist-profile/ # Cyclist profile service
β”‚ β”œβ”€β”€ cyclist-profile/ # Cyclist profile service
β”‚ └── bicycle-racks/ # Bicycle parking facilities service
β”œβ”€β”€ docs/ # Documentation
β”‚ β”œβ”€β”€ CREATE_NEW_SERVICE.md # Guide for creating new services
β”‚ β”œβ”€β”€ SCAFFOLDING_TOOL.md # Scaffolding tool documentation
Expand Down
25 changes: 25 additions & 0 deletions apps/bicycle-racks/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Environment Configuration

# Node Environment
NODE_ENV=development

# Logging
LOG_LEVEL=info

# Server
PORT=3005

# Database
DATABASE_URL=postgres://postgres:postgres@localhost:5432/atlas_dev

# Or use individual settings:
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=atlas_dev

# SSL Configuration
# Path to SSL CA certificate for production databases (e.g., Digital Ocean)
# When set, SSL will be automatically enabled
# DATABASE_SSL_CA=/path/to/ca-certificate.crt
10 changes: 10 additions & 0 deletions apps/bicycle-racks/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NODE_ENV=test
LOG_LEVEL=error
PORT=3005
DATABASE_URL=postgres://postgres:postgres@localhost:5432/atlas_test?sslmode=disable
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=atlas_test
DB_SSL=false
86 changes: 86 additions & 0 deletions apps/bicycle-racks/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Prune stage - Use turbo to create a subset of the monorepo with only the packages needed
FROM node:22.15.0-slim AS pruner

# Set working directory
WORKDIR /app

# Install pnpm and turbo
RUN corepack enable && corepack prepare pnpm@10.10.0 --activate && \
npm install -g turbo

# Copy repo configuration
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./

# Copy the source code needed for turbo prune
COPY apps/bicycle-racks/package.json ./apps/bicycle-racks/package.json
COPY packages/typescript-config/package.json ./packages/typescript-config/package.json
COPY packages/database/package.json ./packages/database/package.json

# Use turbo to prune the monorepo to only the bicycle-racks app and its dependencies
RUN turbo prune --scope=@atlas/bicycle-racks --docker

# Build stage - Use the pruned repo to build the app
FROM node:22.15.0-slim AS builder

# Set working directory
WORKDIR /app

# Install pnpm
RUN corepack enable && corepack prepare pnpm@10.10.0 --activate

# Copy pruned lockfile and package.json files
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=pruner /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml

# Install dependencies
RUN pnpm install --frozen-lockfile

# Copy source files from pruned repo
COPY --from=pruner /app/out/full/ .

# Copy the rest of the source code
COPY apps/bicycle-racks ./apps/bicycle-racks
COPY packages/typescript-config ./packages/typescript-config
COPY packages/database ./packages/database
COPY turbo.json ./turbo.json

# Build database package first (required dependency)
RUN pnpm --filter @atlas/database build

# Build the bicycle-racks app
RUN pnpm --filter @atlas/bicycle-racks build

# Production stage
FROM node:22.15.0-slim AS production

# Set working directory
WORKDIR /app

# Install pnpm
RUN corepack enable && corepack prepare pnpm@10.10.0 --activate

# Copy pruned lockfile and package.json files
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=pruner /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml

# Install production dependencies only
RUN pnpm install --frozen-lockfile --prod

# Copy built files from builder stage
COPY --from=builder /app/apps/bicycle-racks/dist ./apps/bicycle-racks/dist
COPY --from=builder /app/packages/database/dist ./packages/database/dist
# Copy migrations folder from database package
COPY --from=builder /app/packages/database/src/migrations ./packages/database/src/migrations

# Set environment variables
ENV NODE_ENV=production
ENV LOG_LEVEL=info
ENV PORT=3005

# Expose port (can be overridden at runtime)
EXPOSE ${PORT}

# Default command to start the application
CMD ["node", "apps/bicycle-racks/dist/index.js"]
Loading
Loading