Initial commit
This commit is contained in:
		
							
								
								
									
										37
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					# MoneyMgr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Setup dev env
 | 
				
			||||||
 | 
					1. Install prerequisites:
 | 
				
			||||||
 | 
					   1. docker
 | 
				
			||||||
 | 
					   2. docker-compose
 | 
				
			||||||
 | 
					   3. rust
 | 
				
			||||||
 | 
					   4. node
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2. Start services
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					cd moneymgr_backend
 | 
				
			||||||
 | 
					mkdir -p storage/{db,redis-data,redis-conf,minio}
 | 
				
			||||||
 | 
					docker compose up
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					3. Install Diesel CLI:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					sudo apt install libpq5 libpq-dev pkg-config libssl-dev cmake
 | 
				
			||||||
 | 
					cargo install diesel_cli --no-default-features --features postgres
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					4. Initialize database:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					diesel migration run
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> Note: You can access the database directly using this command:
 | 
				
			||||||
 | 
					> 
 | 
				
			||||||
 | 
					> ```bash
 | 
				
			||||||
 | 
					> PGPASSWORD=pass psql -h localhost -p 5432 -U user -d moneymgr
 | 
				
			||||||
 | 
					> ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										3
									
								
								moneymgr_backend/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								moneymgr_backend/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					target
 | 
				
			||||||
 | 
					.idea
 | 
				
			||||||
 | 
					storage
 | 
				
			||||||
							
								
								
									
										7
									
								
								moneymgr_backend/Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								moneymgr_backend/Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					# This file is automatically @generated by Cargo.
 | 
				
			||||||
 | 
					# It is not intended for manual editing.
 | 
				
			||||||
 | 
					version = 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "moneymgr_backend"
 | 
				
			||||||
 | 
					version = "0.1.0"
 | 
				
			||||||
							
								
								
									
										6
									
								
								moneymgr_backend/Cargo.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								moneymgr_backend/Cargo.toml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					[package]
 | 
				
			||||||
 | 
					name = "moneymgr_backend"
 | 
				
			||||||
 | 
					version = "0.1.0"
 | 
				
			||||||
 | 
					edition = "2024"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[dependencies]
 | 
				
			||||||
							
								
								
									
										48
									
								
								moneymgr_backend/docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								moneymgr_backend/docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					services:
 | 
				
			||||||
 | 
					  minio:
 | 
				
			||||||
 | 
					    image: minio/minio
 | 
				
			||||||
 | 
					    user: "1000"
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - MINIO_ROOT_USER=topsecret
 | 
				
			||||||
 | 
					      - MINIO_ROOT_PASSWORD=topsecret
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - ./storage/minio:/data
 | 
				
			||||||
 | 
					    command: [ "minio", "server", "/data", "--console-address", ":9090" ]
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 9000:9000
 | 
				
			||||||
 | 
					      - 9090:9090
 | 
				
			||||||
 | 
					    expose:
 | 
				
			||||||
 | 
					      - 9000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  db:
 | 
				
			||||||
 | 
					    image: postgres
 | 
				
			||||||
 | 
					    user: "1000"
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - "5432:5432"
 | 
				
			||||||
 | 
					    expose:
 | 
				
			||||||
 | 
					      - 5432
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - POSTGRES_USER=user
 | 
				
			||||||
 | 
					      - POSTGRES_PASSWORD=pass
 | 
				
			||||||
 | 
					      - POSTGRES_DB=moneymgr
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - ./storage/db:/var/lib/postgresql/data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  oidc:
 | 
				
			||||||
 | 
					    image: dexidp/dex
 | 
				
			||||||
 | 
					    user: "1000"
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 9001:9001
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - ./docker/dex:/conf:ro
 | 
				
			||||||
 | 
					    command: [ "dex", "serve", "/conf/dex.config.yaml" ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  redis:
 | 
				
			||||||
 | 
					    image: redis:alpine
 | 
				
			||||||
 | 
					    user: "1000"
 | 
				
			||||||
 | 
					    command: redis-server --requirepass ${REDIS_PASS:-secretredis}
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 6379:6379
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - ./storage/redis-data:/data
 | 
				
			||||||
 | 
					      - ./storage/redis-conf:/usr/local/etc/redis/redis.conf
 | 
				
			||||||
							
								
								
									
										26
									
								
								moneymgr_backend/docker/dex/dex.config.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								moneymgr_backend/docker/dex/dex.config.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					issuer: http://127.0.0.1:9001/dex
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					storage:
 | 
				
			||||||
 | 
					  type: memory
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					web:
 | 
				
			||||||
 | 
					  http: 0.0.0.0:9001
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					oauth2:
 | 
				
			||||||
 | 
					  # Automate some clicking
 | 
				
			||||||
 | 
					  # Note: this might actually make some tests pass that otherwise wouldn't.
 | 
				
			||||||
 | 
					  skipApprovalScreen: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					connectors:
 | 
				
			||||||
 | 
					  # Note: this might actually make some tests pass that otherwise wouldn't.
 | 
				
			||||||
 | 
					  - type: mockCallback
 | 
				
			||||||
 | 
					    id: mock
 | 
				
			||||||
 | 
					    name: Example
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Basic OP test suite requires two clients.
 | 
				
			||||||
 | 
					staticClients:
 | 
				
			||||||
 | 
					  - id: foo
 | 
				
			||||||
 | 
					    secret: bar
 | 
				
			||||||
 | 
					    redirectURIs:
 | 
				
			||||||
 | 
					      - http://localhost:5173/web/oidc_cb
 | 
				
			||||||
 | 
					    name: Project
 | 
				
			||||||
							
								
								
									
										3
									
								
								moneymgr_backend/src/main.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								moneymgr_backend/src/main.rs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					fn main() {
 | 
				
			||||||
 | 
					    println!("Hello, world!");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user