Grammateia is a web application for offline document registration. It provides a simple interface for registering incoming and outgoing documents across various categories, assigning them protocol and draft numbers.
- Backend: Python, FastAPI, SQLite
- Frontend: React, TypeScript, Vite, Tailwind CSS
/
├── backend/ # Python FastAPI backend
│ ├── src/
│ └── tests/
├── frontend/ # React/TypeScript frontend
│ └── src/
└── specs/ # Project specifications
Follow these instructions to set up and run the project on your local machine.
- Python 3.9+
- Node.js 18+ and npm
-
Navigate to the backend directory:
cd backend -
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows, use: .venv\Scripts\activate
-
Install Python dependencies:
pip install -r requirements.txt
-
Database initialization (automatic): The first time you run the backend it will automatically create the SQLite database (schema) in a
data/folder at the project root (portable).- On Windows, if you prefer a fixed location (legacy style), you can set an environment variable before running the server: ```bat set REGISTRY_DB_PATH=%CD%\data\app.db ``` (PowerShell: `setx REGISTRY_DB_PATH "$PWD\\data\\app.db"` then open a new shell.) - To force a fresh empty database (this DELETES existing data) you can run: ```sh python -c "from backend.src.services.db import init_db; init_db()" ``` Use this only when you intentionally want to reset everything. -
(Optional) Seed the database with sample data: (Only if you have a seeding script; skip if not present.)
sh python -m backend.src.cli.seed
-
Navigate to the frontend directory:
cd frontend -
Install Node.js dependencies:
npm install
You need to run both the backend and frontend servers.
-
Run the Backend Server: From the
backenddirectory:python -m backend.src.cli.run
The server will be available at
http://127.0.0.1:8733. -
Run the Frontend Development Server: From the
frontenddirectory:npm run dev
The application will be available at
http://localhost:5173.
If you intend to carry this project on a USB stick and run it on a Windows machine:
- Copy the whole project folder onto the USB (or directly onto the target machine).
- On the target Windows PC install (one‑time):
- Python 3.9+ (recommended 3.11)
- Node.js 18+ (LTS)
- Create a virtual environment inside
backendand install dependencies:cd backend py -3 -m venv .venv call .venv\Scripts\activate pip install -r requirements.txt
- Install frontend dependencies:
cd ..\frontend npm install - (Optional) Set a portable DB path so the DB file stays with the project:
set REGISTRY_DB_PATH=%CD%\..\data\app.db
- Start backend (from
backenddirectory, with venv active):python -m backend.src.cli.run
- Start frontend (from
frontend):npm run dev
See WINDOWS_PORTABLE.md for a more detailed, copy‑paste friendly guide (including optional batch scripts).
-
Backend Tests: From the
backenddirectory, run:pytest
-
Frontend Tests: From the
frontenddirectory, run:npm test