MCPcopy Index your code
hub / github.com/TownHallHQ/TownHall

github.com/TownHallHQ/TownHall @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
426 symbols 647 edges 149 files 19 documented · 4% updated 19mo ago★ 3815 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

To read the documentation of the web here

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
crates/cli CLI used to manage the Server instance. run database migrations and other developer tasks
crates/client HTTP Client used as bridge library between client interface and application services
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/types Plain types shared between different application layers
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_tests command:

just e2e_tests 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

Extension points exported contracts — how you extend this code

ImageProvider (Interface)
(no doc) [2 implementers]
crates/core/src/image/service.rs

Core symbols most depended-on inside this repo

to_string
called by 86
crates/core/src/user/model/password.rs
insert
called by 35
crates/core/src/post/repository.rs
is_empty
called by 12
crates/core/src/shared/query_set.rs
into_response
called by 7
crates/server/src/handlers/api/mod.rs
first
called by 6
crates/core/src/shared/pagination.rs
count
called by 6
crates/core/src/shared/query_set.rs
token_create
called by 5
crates/client/src/modules/auth/token_create/mod.rs
user_id
called by 5
crates/core/src/auth/service.rs

Shape

Method 196
Class 107
Function 82
Enum 40
Interface 1

Languages

Rust100%

Modules by API surface

crates/core/src/shared/pagination.rs20 symbols
crates/core/src/user/service.rs16 symbols
crates/core/src/user/repository/user.rs15 symbols
crates/core/src/user/model/password.rs13 symbols
crates/core/src/image/repository.rs12 symbols
crates/core/src/auth/service.rs12 symbols
crates/server/src/graphql/scalars/email.rs10 symbols
crates/core/src/user/repository/follower.rs10 symbols
crates/server/src/handlers/api/mod.rs9 symbols
crates/core/src/image/service.rs9 symbols
crates/types/src/user/username.rs8 symbols
crates/types/src/user/email.rs8 symbols

For agents

$ claude mcp add TownHall \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact