File tree Expand file tree Collapse file tree 5 files changed +80
-8
lines changed
Expand file tree Collapse file tree 5 files changed +80
-8
lines changed Original file line number Diff line number Diff line change @@ -163,3 +163,5 @@ cython_debug/
163163node_modules
164164tsp-output /
165165.aider *
166+
167+ demo_app /
Original file line number Diff line number Diff line change @@ -14,18 +14,14 @@ Generates full stack apps using trpc + shadcn components.
1414
1515### Running generated code
1616
17- Chande directory:
17+ Change directory:
1818
1919` cd demo_app `
2020
2121Configure postgres address:
2222
2323` export DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres `
2424
25- Apply migrations:
26-
27- ` bun run db:push `
28-
2925Start the app:
3026
3127` bun run dev:all `
@@ -36,4 +32,29 @@ Start the app:
3632
3733### Running with docker - doesn't have hot reload
3834
35+ Change directory:
36+
37+ ` cd demo_app `
38+
39+ Run through docker compose:
3940` docker compose up --build `
41+
42+ This will apply DB migrations and start the server/client.
43+
44+ Just open the browser and go to ` http://localhost:80 `
45+
46+ ### Deploying to fly
47+
48+ Change directory:
49+
50+ ` cd demo_app `
51+
52+ Run the following command to deploy the app:
53+
54+ ` fly deploy ` - this will use the Dockerfile in the root to build the app.
55+
56+ If you don't have a fly.toml file, you can create one by running:
57+
58+ ` fly launch `
59+
60+ This will create a new app and deploy it to fly.
Original file line number Diff line number Diff line change 1+ # Build stage for both client and server
2+ FROM oven/bun:1 as builder
3+
4+ # Set working directory
5+ WORKDIR /app
6+
7+ # Copy package files
8+ COPY package.json bun.lockb ./
9+ COPY client/package.json ./client/
10+ COPY server/package.json ./server/
11+
12+ # Install dependencies
13+ RUN bun install --frozen-lockfile
14+
15+ # Copy source code
16+ COPY . .
17+
18+ # Build client and server
19+ RUN cd client && bun run build
20+ RUN cd server && bun run build
21+
22+ # Final stage - use oven/bun as base to avoid compatibility issues
23+ FROM oven/bun:1
24+
25+ # Install nginx directly
26+ RUN apt-get update && apt-get install -y nginx && apt-get clean
27+
28+ # Copy frontend files
29+ COPY --from=builder /app/client/dist /usr/share/nginx/html
30+ COPY ./client/nginx/nginx.conf /etc/nginx/conf.d/default.conf
31+
32+ # Modify nginx config - in fly it needs to be 8080
33+ RUN sed -i 's/listen 80;/listen 8080;/g' /etc/nginx/conf.d/default.conf
34+ RUN sed -i 's/app-backend/localhost/g' /etc/nginx/conf.d/default.conf
35+
36+ # Copy backend files
37+ COPY --from=builder /app/server /app/server
38+ COPY --from=builder /app/node_modules /app/node_modules
39+
40+ # Create a simple start script
41+ RUN echo '#!/bin/sh\n nginx &\n cd /app/server && bun run start:build' > /start.sh
42+ RUN chmod +x /start.sh
43+
44+ # Expose port
45+ EXPOSE 8080
46+
47+ # Use the script
48+ CMD ["/start.sh" ]
Original file line number Diff line number Diff line change 55 "build" : " tsc" ,
66 "dev" : " bun --hot src/index.ts" ,
77 "db:push" : " drizzle-kit push --force" ,
8- "lint" : " eslint --cache src/index.ts"
8+ "lint" : " eslint --cache src/index.ts" ,
9+ "start:build" : " drizzle-kit push --force && node dist/src/index.js"
910 },
1011 "dependencies" : {
1112 "@trpc/server" : " npm:@trpc/server@next" ,
Original file line number Diff line number Diff line change @@ -25,5 +25,5 @@ RUN cd server && bun run build
2525# Expose the server port
2626EXPOSE 2022
2727
28- # Run the server (adjust the path if needed)
29- CMD [ "node" , " server/dist/src/index.js" ]
28+ # Run the server
29+ CMD cd server && bun run start:build
You can’t perform that action at this time.
0 commit comments