# ⏰ ActaTempus: Time Tracking and Management System ## 🌟 Overview **ActaTempus** is a system for work hour management and tracking, showcasing differences and similarities in functional programming using two backend implementations: **Go** and **Dart**. The current focus is backend development, while frontend development has been separated for future hobbyist work. Interaction with the system is facilitated through **Insomnia**, with an Insomnia collection provided in `docs/insomnia`. --- ## 🚀 Features ✅ **User Management**: Registration, login, profile updates ✅ **Time Tracking**: Start/stop tracking, manual entries, and break management ✅ **Project Management**: Create and manage projects, tasks, and time entries ✅ **Task Management**: Manage tasks related to projects --- ## 🏗️ Architecture ActaTempus adheres to **Domain-Driven Design (DDD)** and **Clean Architecture** principles. The system is divided into **four primary layers**: ![Architecture Diagram](docs/media/architecture.png) 1️⃣ **Domain Layer**: - Contracts, definitions, and core logic. 2️⃣ **Infrastructure Layer**: - Database integrations and external service interfaces (e.g., Prisma with PostgreSQL). 3️⃣ **Application Layer**: - Business logic, services, and response handling. 4️⃣ **Interface Layer**: - REST APIs for external communication. --- ## 📑 Specification The detailed system specification is available in the documentation. Refer to the specification document for an in-depth understanding of the system design, architecture, and implementation details. [📄 View the Specification](docs/KP_Spec-4.pdf) --- ## 🛠️ Technology Stack ### ⚙️ Backend #### Go: - **Gin**: HTTP web framework for building REST APIs. - **GORM**: PostgreSQL ORM for database interactions. - **Prisma-Go**: Schema management and database adapter. - **JWT (golang-jwt)**: Authentication and token generation. - **fp-go**: Functional programming library for Go. - **Viper**: Configuration management. - **UUID**: Library for unique identifier generation. - **Decimal (shopspring/decimal)**: High-precision decimal arithmetic. #### Dart: - **ORM (Drift/Aqueduct)**: Object-relational mapping for database integration. - **PostgreSQL**: Database connectivity and query execution. - **Shelf**: HTTP server framework. - **Shelf Router**: Routing for Shelf applications. - **JWT (dart_jsonwebtoken)**: Authentication and token generation. - **fpdart**: Functional programming library for Dart. - **Riverpod**: State management for the application. - **Freezed**: Immutable data classes and sealed classes. - **UUID**: Unique identifier generation. - **Crypto**: Cryptographic utilities. ### 📦 Database - **PostgreSQL**: Primary database for structured data storage. - **Prisma ORM**: Shared schema across Go and Dart implementations, providing unified database management. --- ## 📁 Directory Structure ``` backend-go/ # Go backend implementation backend-dart/ # Dart backend implementation docs/ # Documentation, including Insomnia collections ``` --- ## 📖 Getting Started ### Prerequisites For a seamless development experience, use the provided **devcontainer** setup. Ensure you have the following installed: - [Docker](https://www.docker.com/) - [VisualStudioCode](https://code.visualstudio.com/) If you dont want to use devcontainers and/or docker you need to install the following dependencies on your own: - Go (1.21.0) - Dart (3.6.0-1) - PostgreSQL - NodeJS (required for Prisma) ### 🔧 Installation 1. **Clone the repository**: ```bash git clone https://inf-git.th-rosenheim.de/studavrije7683/ws24-kp-avril.git cd ws24-kp-avril ``` 2. **Use the devcontainer**: Launch it with Visual Studio Code: ```bash code . ``` --- ## 🖥️ Running ActaTempus ### Backend (Go) ```bash cd backend-go go run cmd/actatempus/main.go # Starts on port 8080 ``` ### Backend (Dart) ```bash cd backend-dart dart run bin/backend_dart.dart # Starts on port 8080 ``` --- ### 🗄️ Database Management ActaTempus uses **Prisma ORM** for schema management and code generation across both backends. Start the PostgreSQL server using the provided `docker-compose.yml`: ```bash docker compose up ``` #### Deploy the Schema Apply the schema using Prisma. Only one backend needs to execute the command, as both backends share the schema: ```bash cd backend-go go run github.com/steebchen/prisma-client-go db push ``` or ```bash cd backend-dart bunx prisma db push ``` #### Prisma Studio Launch Prisma Studio for database visualization and management: ```bash cd backend-dart bunx prisma studio ``` ### Code Generation Regenerate ORM code after modifying the `schema.prisma` file: ##### Dart ```bash cd backend-dart bunx prisma generate ``` ##### Go ```bash cd backend-go go run github.com/steebchen/prisma-client-go generate ``` --- ## ⚠️ Testing ##### Dart ```bash cd backend-dart dart test ``` ##### Go ```bash cd backend-go go test ./... -v ``` --- ## 📖 Interaction with the System Use **[Insomnia](https://insomnia.rest/)** for interacting with the APIs. The Insomnia collection is provided under `docs/insomnia`. Import it to get started quickly with predefined requests. ![Insomnia Demo](docs/media/insomnia2.gif) --- ## 🛣️ Roadmap ### Phase 1: **Initialize** - ✅ Define specifications - ✅ Set up repository ### Phase 2: **Setup** - ✅ Frontend (Next.js, Deno) - ✅ Backends (Dart & Go) - ✅ Devcontainer ### Phase 3: **MVP Development** - Build foundational backends in Go & Dart - Implement: - ✅ Domain layer (Entities, Repositories) - ✅ Application logic (Services, DTOs, JWT Authentication) - ✅ Basic authorization ### Phase 4: **Web UI** - 🎨 Build frontend for: - Timetracking - Project management - Reporting --- ## 🌐 Resources - [Functional Programming in Go](https://pkg.go.dev/github.com/IBM/fp-go) - [Dart Documentation](https://dart.dev/)