Skip to content

Latest commit

Β 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DULO - Digitalisasi Usaha Lokal

Transform Your Manual Bookkeeping into Smart Digital Records

DULO is an intelligent document digitization platform designed to help local businesses convert their manual bookkeeping records, receipts, and handwritten notes into structured digital formats (Excel/PDF) with AI-powered insights.


🎯 Main Purpose

Manual bookkeeping is still prevalent among small and local businesses. DULO solves this problem by:

  • Digitizing handwritten ledgers, receipts, and notes through OCR technology
  • Converting captured data into organized Excel spreadsheets or PDF documents
  • Providing AI-powered consultation to help business owners understand and analyze their financial data

✨ Key Features

πŸ“Έ Smart Document Capture

  • Capture photos of handwritten bookkeeping records, receipts, and business notes
  • Advanced OCR (Optical Character Recognition) powered by PaddleOCR
  • Support for various document types and handwriting styles

πŸ“Š Automatic Data Conversion

  • Convert captured data into structured Excel spreadsheets
  • Export clean, formatted PDF documents
  • Maintain data integrity and accuracy

πŸ€– AI-Powered Consultation

  • Ask questions about your financial data directly to AI
  • Get insights, summaries, and analysis of your bookkeeping records
  • Understand trends, patterns, and potential issues in your business finances

πŸ” Secure & Private

  • User authentication with JWT tokens
  • Email verification system
  • Secure data storage and processing

πŸ› οΈ Tech Stack

Frontend

  • React - UI library
  • Vite - Fast build tool and dev server
  • TypeScript - Type-safe JavaScript
  • Tailwind CSS - Utility-first CSS framework
  • Framer Motion - Animation library
  • React Router - Client-side routing
  • Radix UI - Accessible component primitives

Backend

  • Python 3.11 - Programming language
  • Flask - Lightweight web framework
  • PaddleOCR - OCR engine for text recognition
  • JWT - Authentication & authorization
  • SQLite/PostgreSQL - Database options
  • APScheduler - Background task scheduling
  • XlsxWriter - Excel file generation
  • ReportLab - PDF generation

DevOps

  • Docker - Containerization
  • Docker Compose - Multi-container orchestration
  • Nginx - Reverse proxy and static file serving
  • Gunicorn - WSGI HTTP server

πŸš€ Getting Started

Prerequisites

Make sure you have the following installed:

  • Docker (20.10 or higher)
  • Docker Compose (v2.0 or higher)

Test Login

Installation & Running

Option 1: Using Docker Compose (Recommended)

  1. Clone the repository

    git clone <repository-url>
    cd dulo
  2. Configure environment variables

    Copy the example environment file in the backend directory:

    cp backend/.env.example backend/.env

    Edit backend/.env and configure your settings:

    # Database
    DATABASE_TYPE=sqlite
    DATABASE_PATH=database/database.db
    
    # Database Configuration for PostgreSQL
    POSTGRES_HOST=localhost
    POSTGRES_PORT=5432
    POSTGRES_USER=postgre
    POSTGRES_PASSWORD=
    POSTGRES_DB=ocr_db
    POSTGRES_SSLMODE=require
    
    # JWT Secret (change this in production!)
    JWT_SECRET_KEY=your-super-secret-key-change-in-production
    
    # Email Configuration (optional)
    RESEND_API_KEY=your-resend-api-key
    EMAIL_FROM=noreply@yourdomain.com
    FRONTEND_URL=http://localhost:5173
    
    # AI Configuration (optional)
    KOLOSAL_API_KEY=your-kolosal-api-key
    KOLOSAL_OCR_API_KEY=your-kolosal-api-key
    KOLOSAL_MAX_TOKENS=1000
    
    # Download Directory (for Docker volume)
    DOWNLOAD_DIR=download
    
    # CORS-allowed URLs (comma-separated)
    ORIGIN_URL=http://localhost:3000,http://localhost:5173
  3. Build and run with Docker Compose

    docker-compose up --build

    Or run in detached mode:

    docker-compose up -d --build
  4. Access the application

  5. Stop the application

    docker-compose down

Option 2: Manual Setup (Development)

Backend Setup
  1. Navigate to backend directory

    cd backend
  2. Create virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment

    cp .env.example .env
    # Edit .env with your configuration
  5. Initialize database

    python create_tables.py
    python seeders.py
  6. Run the backend server

    python app.py

    Backend will be available at http://localhost:8000

Frontend Setup
  1. Navigate to frontend directory

    cd frontend
  2. Install dependencies

    npm install
  3. Run development server

    npm run dev

    Frontend will be available at http://localhost:5173 (Vite default port)

  4. Build for production

    npm run build

πŸ“ Project Structure

dulo/
β”œβ”€β”€ backend/                 # Python Flask backend
β”‚   β”œβ”€β”€ app.py              # Main application entry point
β”‚   β”œβ”€β”€ config.py           # Configuration settings
β”‚   β”œβ”€β”€ models.py           # Database models
β”‚   β”œβ”€β”€ requirements.txt    # Python dependencies
β”‚   β”œβ”€β”€ Dockerfile          # Backend Docker configuration
β”‚   β”œβ”€β”€ core/               # Core business logic
β”‚   β”œβ”€β”€ database/           # Database files (SQLite)
β”‚   β”œβ”€β”€ download/           # Generated files storage
β”‚   β”œβ”€β”€ middleware/         # Custom middleware
β”‚   └── ml/                 # Machine learning (OCR) modules
β”‚
β”œβ”€β”€ frontend/               # React Vite TypeScript frontend
β”‚   β”œβ”€β”€ src/               # Source code
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   β”œβ”€β”€ package.json       # Node dependencies
β”‚   β”œβ”€β”€ vite.config.ts     # Vite configuration
β”‚   β”œβ”€β”€ tailwind.config.js # Tailwind CSS configuration
β”‚   β”œβ”€β”€ Dockerfile         # Frontend Docker configuration
β”‚   └── nginx.conf         # Nginx configuration for production
β”‚
β”œβ”€β”€ data/                  # Persistent data (created by Docker)
β”‚   β”œβ”€β”€ database/         # Database files
β”‚   └── download/         # Generated documents
β”‚
β”œβ”€β”€ docker-compose.yml    # Docker Compose orchestration
└── README.md            # This file

πŸ”Œ API Endpoints

Authentication

  • POST /auth/register - Register new user
  • POST /auth/login - Login and get JWT token
  • POST /auth/refresh - Refresh JWT access token
  • POST /auth/logout - Logout and delete cookies
  • GET /auth/verif-email - Verify email address
  • POST /auth/resend-verification - Resend verification email
  • PUT /auth/update-profile - Update fullname user (Protected - Requires JWT)

OCR (Protected - Requires JWT)

  • POST /ocr - Single image OCR with queue
  • POST /ocr/batch - Batch image OCR with queue
  • GET /take/<job_id> - Get queue status and download link
  • GET /download/<filename> - Download file by filename
  • POST /ocr/direct - Direct OCR (no queue)

Chat AI (Protected - Requires JWT)

  • POST /chat - Chat with an AI that knows the context of the data in the photo
  • GET /chat/history - Get all chats for current user
  • GET /chat/<chat_id> - Get chat details and messages

Public

  • GET /health - Health check
  • GET /stats - Server statistics

πŸ” Authentication

The API uses JWT (JSON Web Tokens) for authentication. Include the token in the Authorization header:

Authorization: Bearer <your-jwt-token>

🌍 Environment Variables

Backend Configuration

Variable Description Default
HOST Server host 0.0.0.0
PORT Server port 8000
DEBUG Debug mode false
DATABASE_TYPE Database type (sqlite/postgresql) sqlite
DATABASE_PATH SQLite database path database/database.db
JWT_SECRET_KEY Secret key for JWT tokens Required
RESEND_API_KEY Resend API key for emails Optional
EMAIL_FROM Sender email address Optional
KOLOSAL_API_KEY Kolosal AI API key Optional
KOLOSAL_OCR_API_KEY Kolosal AI OCR API key Optional
KOLOSAL_MAX_TOKENS Kolosal AI max tokens Optional
FRONTEND_URL Frontend URL for email links http://localhost:3000
DOWNLOAD_DIR Download file directory download
ORIGIN_URL CORS-allowed URLs (comma-separated) http://localhost:3000,http://localhost:5173

🐳 Docker Configuration

Services

  • backend: Flask API server (port 8000)
  • frontend: React app served by Nginx (port 3000)

Volumes

  • ./data/database: Persistent database storage
  • ./data/download: Generated Excel/PDF files

Networks

All services communicate through the dulo-network bridge network.


πŸ§ͺ Development

Run Tests

# Backend tests (if available)
cd backend
pytest

# Frontend tests
cd frontend
npm run test

Linting

# Frontend linting
cd frontend
npm run lint

# Backend linting (if configured)
cd backend
flake8 .

Build Frontend for Production

cd frontend
npm run build

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ™‹ Support

For support, please open an issue in the GitHub repository or contact the maintainers.


🎯 Roadmap

  • [βœ”] Multi-language OCR support
  • [βœ”] Receipt scanning from mobile camera
  • Add another support tools
  • Add object storage and file management
  • Advanced AI analytics dashboard

πŸ“Έ Screenshots

Demo Image Demo Image Demo Image Demo Image Demo Image Demo Image Demo Image Demo Image


Made with ❀️ for Local Businesses

About

DULO - Digitalisasi Usaha Lokal Transform Your Manual Bookkeeping into Smart Digital Records

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages