Skip to content

TownHallHQ/TownHall

Repository files navigation

TownHall

Discord Build Clippy Formatter

Collab Strategy and Knowledge Sharing

TownHall is collaborative project for novice-to-intermediate Rust developers. We’re learning-by-doing together, in the making of a community platform modeled after the likes of Reddit space oriented and X (formerly Twitter) microblogging platform.

The project leader and default mentor for new contributors is @EstebanBorai. New mentors and mentees alike are always welcome!

Development

Requirements

Getting Started

# install just command runner
cargo install just

# clone this repository
git clone https://github.com/whizzes/townhall.git


# step into repository directory
cd ./townhall

# open a termital window and spin up Docker Containers
just dev

# create a new terminal window and run database migrations
just prepare

# execute the server (next time you just run this command)
cargo run serve

Note: As of today migrations runs when bootstrapping the server automatically

Software Architecture

Layers

Client traffic is handled by a GraphQL endpoint, domain logic is exposed through services which encapsulate access to the database logic. The CLI solution communicates directly to the services.

softarq

Design

This project takes some inspiration on Domain Driven Design, but does not implements its concepts completely. Concepts like value object, model, repositories and services are present but are not 100% accurate to the original Domain Driven Design architecture.

Modules

The client and server solution is available in this repository.

Directory Description
client Web Front-End, written in SvelteKit & TypeScript
crates/ Contains GraphQL Server Logic, CLI and Domain libraries. Rust is the predominant language.
crates/cli CLI used to manage the Server instance. run database migrations and other developer tasks
crates/core Domain Logic, includes Models, Value Objects, Repositories and Services
crates/entity Entities generated from database
crates/migration Database migrations
crates/server HTTP Server Logic, uses Axum and GraphQL
crates/test E2E Tests for the GraphQL Server
crates/web Web UI, written in Leptos

Testing

Running E2E Tests

E2E Tests run by default on a different database, this allow us to have a database for development and another for testing, speeding up the development process.

The dedicated E2E Database will be builded along with other containers when running just dev.

You can also execute a single E2E Test by specifying the name of the test function along with the just e2e_test command:

just e2e_test my_super_test_function_name

To run every test just execute:

just e2e_test

Teardown containers using just undev.

Contributors

Esteban Borai
Esteban Borai

💻
Michael Liendo
Michael Liendo

💻
David Arenas
David Arenas

💻
CudiLala
Cudi Lala

💻
Paly Zambrano
Paly Zambrano

💻
Phosphorus-M
Phosphorus-M

💻
David Rodriguez
David Rodríguez

💻

License

Licensed under the MIT License