Skip to content

Commit

Permalink
Deploy - Deploy do back-end
Browse files Browse the repository at this point in the history
  • Loading branch information
vinifraga committed Sep 12, 2024
1 parent 89409b9 commit 6e5f587
Show file tree
Hide file tree
Showing 5 changed files with 632 additions and 4 deletions.
5 changes: 4 additions & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"dev": "pnpm env:load tsx watch src/http/server.ts",
"db:migrate": "pnpm env:load prisma migrate dev",
"db:studio": "pnpm env:load prisma studio",
"env:load": "dotenv -e ../../.env --"
"env:load": "dotenv -e ../../.env --",
"build": "tsup",
"start": "node dist/http/server.js"
},
"dependencies": {
"@fastify/cors": "^9.0.1",
Expand All @@ -30,6 +32,7 @@
"@types/node": "^20.12.6",
"dotenv-cli": "^7.4.1",
"prisma": "^5.12.1",
"tsup": "^8.2.4",
"tsx": "^4.7.2"
},
"prisma": {
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/http/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ app.register(getPendingInvites)

app.register(getOrganizationBilling)

app.listen({ port: env.SERVER_PORT }).then(() => {
app.listen({ port: env.PORT, host: '0.0.0.0' }).then(() => {
console.log('HTTP server running!')
})
9 changes: 9 additions & 0 deletions apps/api/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'tsup'

export default defineConfig({
entry: ['src'],
splitting: false,
sourcemap: true,
clean: true,
noExternal: ['@saas/auth', '@saas/env'],
})
4 changes: 2 additions & 2 deletions packages/env/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { z } from 'zod'

export const env = createEnv({
server: {
SERVER_PORT: z.coerce.number().default(3333),
PORT: z.coerce.number().default(3333),
DATABASE_URL: z.string().url(),

JWT_SECRET: z.string(),
Expand All @@ -17,7 +17,7 @@ export const env = createEnv({
NEXT_PUBLIC_API_URL: z.string().url(),
},
runtimeEnv: {
SERVER_PORT: process.env.SERVER_PORT,
PORT: process.env.SERVER_PORT,
DATABASE_URL: process.env.DATABASE_URL,
JWT_SECRET: process.env.JWT_SECRET,
GITHUB_OAUTH_CLIENT_ID: process.env.GITHUB_OAUTH_CLIENT_ID,
Expand Down
Loading

0 comments on commit 6e5f587

Please sign in to comment.