-
Notifications
You must be signed in to change notification settings - Fork 8
Code Structure
Max Azatian edited this page Oct 5, 2024
·
1 revision
This document outlines the structure of the Flet-Chat project, explaining the purpose of each directory and key files.
-
.github/workflows/: Contains GitHub Actions workflow files for CI/CD.-
tests.yml: Defines the testing workflow for the project.
-
-
chat/: Contains the frontend Flet application code.-
api_client.py: Handles API requests to the backend. -
app.py: Main application file for the Flet frontend. -
chat_list_screen.py: UI and logic for the chat list screen. -
chat_screen.py: UI and logic for individual chat screens. -
login_screen.py: Login screen implementation. -
register_screen.py: Registration screen implementation. -
user_profile_screen.py: User profile screen implementation.
-
-
chat_service/: Contains the backend FastAPI service.-
app/: Main application package.-
api/: API route definitions.-
auth.py: Authentication-related endpoints. -
chats.py: Chat-related endpoints. -
dependencies.py: Dependency injection configurations. -
messages.py: Message-related endpoints. -
users.py: User-related endpoints.
-
-
domain/: Domain models and business logic.-
entities.py: Core domain entities. -
events.py: Domain events.
-
-
gateways/: Interface layer between domain and infrastructure.-
chat_gateway.py: Chat-related data access. -
interfaces.py: Abstract base classes for gateways. -
message_gateway.py: Message-related data access. -
token_gateway.py: Token management. -
user_gateway.py: User-related data access.
-
-
infrastructure/: Implementation details and external services.-
database.py: Database connection and session management. -
data_mappers.py: Mapping between domain entities and database models. -
event_dispatcher.py: Event dispatching mechanism. -
event_handlers.py: Handlers for domain events. -
models.py: SQLAlchemy ORM models. -
redis_client.py: Redis client for caching and real-time features. -
schemas.py: Pydantic schemas for request/response validation. -
security.py: Security-related utilities (e.g., password hashing). -
uow.py: Unit of Work pattern implementation.
-
-
interactors/: Use case implementations.-
chat_interactor.py: Chat-related use cases. -
message_interactor.py: Message-related use cases. -
token_interactor.py: Token-related use cases. -
user_interactor.py: User-related use cases.
-
-
tests/: Test suite for the backend.-
integration/: Integration tests. -
unit/: Unit tests. -
conftest.py: Pytest configuration and fixtures.
-
-
config.py: Application configuration. -
main.py: FastAPI application entry point.
-
-
Dockerfile: Docker configuration for the backend service. -
init.sql: Initial SQL script for database setup. -
requirements.txt: Python dependencies for the backend.
-
-
docker-compose.yml: Docker Compose configuration for running the entire stack. -
LICENSE: Project license file. -
main.py: Entry point for the Flet frontend application. -
README.md: Project overview and documentation. -
requirements.txt: Python dependencies for the frontend.
- The project is split into frontend (
chat/) and backend (chat_service/) components. - The frontend uses Flet for building the UI and interacts with the backend via an API client.
- The backend follows a clean architecture approach with clear separation of concerns:
- Domain layer (
domain/) contains core business logic. - Use cases (
interactors/) implement application-specific logic. - Gateways (
gateways/) provide an abstraction over data access. - Infrastructure (
infrastructure/) handles external concerns like databases and caching.
- Domain layer (
- The API layer (
api/) defines the HTTP endpoints using FastAPI. - Testing is separated into unit and integration tests.
- Docker is used for containerization, making deployment and development environment setup easier.