Skip to content

CodeMaster4711/FinanceVault

Repository files navigation

FinanceVault πŸ’°

A secure financial management application with end-to-end encryption, built with Rust (Axum) backend and SvelteKit frontend.

Build and Push Docker Image Release

πŸš€ Features

  • πŸ” Secure Authentication - JWT-based authentication with bcrypt password hashing
  • πŸ”’ RSA Encryption - End-to-end encryption for sensitive data
  • πŸ’Έ Expense Tracking - Track and categorize your expenses
  • πŸ“Š Subscription Management - Monitor recurring subscriptions
  • πŸ—„οΈ SQLite Database - Lightweight and portable database
  • 🐳 Docker Ready - Single unified container for easy deployment
  • πŸ“± Responsive UI - Modern SvelteKit frontend with Tailwind CSS
  • πŸ“š API Documentation - Interactive Swagger UI

πŸƒ Quick Start

Using Docker (Recommended)

Option 1: Pull from GitHub Container Registry

docker run -d \
  --name financevault \
  -p 8000:8000 \
  -p 3000:3000 \
  -v financevault_data:/data \
  -e JWT_SECRET=$(openssl rand -hex 32) \
  -e RUST_LOG=info \
  ghcr.io/codemaster4711/financevault:latest

Option 2: Using the start script

# Download and run the start script
curl -O https://raw.githubusercontent.com/CodeMaster4711/FinanceVault/main/start-docker.sh
chmod +x start-docker.sh
./start-docker.sh

Option 3: Using Docker Compose

# Create .env file with JWT secret
echo "JWT_SECRET=$(openssl rand -hex 32)" > .env

# Start with docker-compose
docker-compose up -d

# View logs
docker-compose logs -f

Access the Application

πŸ› οΈ Development

Prerequisites

  • Rust (nightly) - Backend development
  • Node.js 20+ - Frontend development
  • Docker - For containerized development
  • SQLite - Database

Local Development Setup

Backend

cd backend

# Install dependencies
cargo build

# Run migrations
cargo run --bin migration

# Start development server
cargo run

Frontend

cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

Building from Source

# Build Docker image
docker build -t financevault:local .

# Run locally built image
docker run -d \
  --name financevault \
  -p 8000:8000 \
  -p 3000:3000 \
  -v financevault_data:/data \
  -e JWT_SECRET=$(openssl rand -hex 32) \
  financevault:local

πŸ“¦ Docker Commands

Basic Operations

# Start container
docker start financevault

# Stop container
docker stop financevault

# View logs
docker logs -f financevault

# Restart container
docker restart financevault

# Remove container
docker rm -f financevault

Troubleshooting

# Check container status
docker ps -a | grep financevault

# Access container shell
docker exec -it financevault /bin/bash

# View backend logs only
docker logs financevault 2>&1 | grep "\[BACKEND\]"

# View frontend logs only
docker logs financevault 2>&1 | grep "\[FRONTEND\]"

πŸ”’ Security

Environment Variables

Variable Required Default Description
JWT_SECRET Yes - Secret key for JWT token generation (min 32 chars)
RUST_LOG No info Log level (debug, info, warn, error)
DATABASE_URL No sqlite:/data/finance.db Database connection string
FRONTEND_URL No http://localhost:3000 Frontend URL for CORS

Generate Secure JWT Secret

# Generate a secure random JWT secret
openssl rand -hex 32

⚠️ Important: Always use a strong, randomly generated JWT_SECRET in production!

πŸ“Š Database

The application uses SQLite with automatic migrations. The database file is stored in /data/finance.db inside the container, which is persisted using Docker volumes.

Backup Database

# Create backup
docker cp financevault:/data/finance.db ./backup-$(date +%Y%m%d).db

# Restore backup
docker cp ./backup-20250104.db financevault:/data/finance.db
docker restart financevault

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Docker Container                    β”‚
β”‚                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Frontend    β”‚    β”‚     Backend      β”‚ β”‚
β”‚  β”‚  SvelteKit   │───▢│   Rust (Axum)    β”‚ β”‚
β”‚  β”‚  Port 3000   β”‚    β”‚    Port 8000     β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                             β”‚               β”‚
β”‚                      β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚                      β”‚  SQLite DB    β”‚     β”‚
β”‚                      β”‚  /data/       β”‚     β”‚
β”‚                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ§ͺ Testing

# Backend tests
cd backend
cargo test

# Frontend tests
cd frontend
npm test

# Test Docker build
./test-docker.sh

πŸ“ API Endpoints

Authentication

  • POST /api/register - Register new user
  • POST /api/login - Login user
  • POST /api/logout - Logout user
  • GET /api/user - Get user profile

Expenses

  • GET /api/expenses - List expenses
  • POST /api/expenses - Create expense
  • GET /api/expenses/:id - Get expense
  • PUT /api/expenses/:id - Update expense
  • DELETE /api/expenses/:id - Delete expense

Subscriptions

  • GET /api/subscriptions - List subscriptions
  • POST /api/subscriptions - Create subscription
  • GET /api/subscriptions/:id - Get subscription
  • PUT /api/subscriptions/:id - Update subscription
  • DELETE /api/subscriptions/:id - Delete subscription

🀝 Contributing

We use Conventional Commits for semantic versioning.

See CONTRIBUTING.md for detailed guidelines.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support


Made with ❀️ by the FinanceVault Team

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •