Skip to content

Commit 8db511a

Browse files
committed
Docker
1 parent 8229f7d commit 8db511a

11 files changed

+485
-460
lines changed

.gitignore

+128
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,130 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
142
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
276
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# Docusaurus cache and generated files
108+
.docusaurus
109+
110+
# Serverless directories
111+
.serverless/
112+
113+
# FuseBox cache
114+
.fusebox/
115+
116+
# DynamoDB Local files
117+
.dynamodb/
118+
119+
# TernJS port file
120+
.tern-port
121+
122+
# Stores VSCode versions used for testing VSCode extensions
123+
.vscode-test
124+
125+
# yarn v2
126+
.yarn/cache
127+
.yarn/unplugged
128+
.yarn/build-state.yml
129+
.yarn/install-state.gz
130+
.pnp.*

README.md

-42 Bytes

Prerequisites

  • Node.js (v14 or later)
  • PostgreSQL
  • Docker
  • Docker Compose
  • Plaid account (for bank integration)
  • Stripe account (for payment processing)

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd finance-app
    
  2. Install dependencies for both frontend and backend:

    cd client && npm install
    cd ../server && npm install
    
  3. Set up environment variables:

    • Create a .env file in the server directory based on the .env.example file
    • Create a .env file in the client directory based on the .env.example file
  4. Start the development servers:

    # In the server directory
    npm run dev
    
    # In the client directory
    npm run dev
    
  5. Build and start the application using Docker:

    docker-compose up --build
    
  6. Open your browser and navigate to http://localhost:5173 to view the application.

Project Structure

  • client/: React frontend application
    • src/: Source files for the React app
      • components/: Reusable React components
      • pages/: Main page components
      • graphql/: GraphQL queries and mutations
      • context/: React context providers
      • styles/: Global styles and theme configuration
  • server/: Node.js backend application
    • config/: Configuration files
    • graphql/: GraphQL schema and resolvers
    • models/: Sequelize model definitions
    • services/: Business logic and external API integrations
    • utils/: Utility functions and helpers

client/Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:20-alpine
2+
WORKDIR /app
3+
COPY package*.json ./
4+
RUN npm install
5+
COPY . .
6+
EXPOSE 5173
7+
CMD ["npm","run","dev"]

client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7-
"dev": "vite",
7+
"dev": "vite --host",
88
"build": "vite build",
99
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
1010
"preview": "vite preview"

docker-compose.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
version: '3.8'
2+
3+
services:
4+
server:
5+
build:
6+
context: ./server
7+
container_name: graphql-server
8+
ports:
9+
- '3000:3000'
10+
environment:
11+
- NODE_ENV=development
12+
- DB_HOST=postgres
13+
- DB_PORT=5432
14+
- DB_USER=${DB_USER}
15+
- DB_PASS=${DB_PASS}
16+
- DB_NAME=${DB_NAME}
17+
- JWT_SECRET=${JWT_SECRET}
18+
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
19+
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
20+
- PLAID_CLIENT_ID=${PLAID_CLIENT_ID}
21+
- PLAID_SECRET=${PLAID_SECRET}
22+
- PLAID_ENV=${PLAID_ENV}
23+
depends_on:
24+
- postgres
25+
volumes:
26+
- ./server:/app # For hot-reloading
27+
- /app/node_modules # Avoid local node_modules mismatch
28+
networks:
29+
- graphql-network # Added network for consistency
30+
31+
client:
32+
build:
33+
context: ./client
34+
container_name: graphql-client
35+
networks:
36+
- graphql-network
37+
ports:
38+
- '5173:5173'
39+
environment:
40+
- REACT_APP_API_URL=http://localhost:3000/graphql
41+
- VITE_GOOGLE_CLIENT_ID=${VITE_GOOGLE_CLIENT_ID}
42+
depends_on:
43+
- server
44+
volumes:
45+
- ./client:/app # For hot-reloading
46+
- /app/node_modules # Avoid local node_modules mismatch
47+
48+
postgres:
49+
image: postgres:14-alpine
50+
container_name: pg-database
51+
networks:
52+
- graphql-network
53+
environment:
54+
POSTGRES_USER: ${DB_USER}
55+
POSTGRES_PASSWORD: ${DB_PASS}
56+
POSTGRES_DB: ${DB_NAME}
57+
POSTGRES : ${DB_USER}
58+
ports:
59+
- '5432:5432'
60+
volumes:
61+
- postgres-data:/var/lib/postgresql/data
62+
63+
volumes:
64+
postgres-data:
65+
66+
networks:
67+
graphql-network:
68+
driver: bridge

server/Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:20-alpine
2+
WORKDIR /app
3+
COPY package*.json ./
4+
RUN npm install
5+
COPY . .
6+
EXPOSE 3000
7+
CMD ["npm","start"]

0 commit comments

Comments
 (0)