The goal of polity is to create a - theoretically - global real-time decision platform for political parties, individuals and public bodies.
Our Goal & Figma Clickdummy 🚀
Message tobias.hassebrock@gmail.com to gain access to the Figma Design files.
We are meeting every Wednesday at 8pm CET on a discord server to work on the project and have a good time in general. To start, you can choose a task from our published projects or suggest your own ideas.
Discord server:
👉Issues
👉Projects
Contact:
tobias.hassebrock@gmail.com
Drop me a message/pull request here on GitHub or per mail if you are interested in supporting the project.
- Clone the repo
git clone https://github.com/Donnerstagnacht/polity.git
- Install Node-Js
https://nodejs.org/en/
- Install NPM packages
npm install
- Set up local development for supabase
https://supabase.com/docs/guides/cli/local-development
- Start Angular dev server
ng serve
Polity is based 100% on OpenSource technologies and is self-hostable.
- Backend: Supabase
- Frontend: Angular
- Frontend: State Management is self written: Angular Signals
- UI-library: Taiga UI
- e2e Testing: Cypress
Data is queried mostly by PostgreSQL functions. The functions are executed in a wrapper service that handles loading and UI flags.
Additionally, a Supabase real-time subscription is used to update the store (and therefore the UI) pessimistically whenever subscribed data in the database is changed.
To display data to the user, the data is stored in Angular Signals.
*** Data in ***
User --> PostgreSQL function --> Database --> UI
*** Data out: ***
Database --> Query Function and/or real-time subscription --> Signal Store--> UI --> User
Summary: Most business logic is transferred to powerful PostgreSQL functions.
Angular files are organized in the src/app
. Subfolders mirror app features and mostly correspond to the available routes.
Cypress files are organized in the Cypress/e2e
folder and the file order should be identical to the test execution order.
Supabase files are organized in the supabase/migrations
folder. These files must have a prefix that determines the migration/execution order.
- cypress: End-2-End tests organized by features
- src
- app: Frontend
- auth: Authentication functionality
- features: Features organized by routing
- feature: One feature module
- components: Presentation logic
- routes: Routes of the feature
- store: Front end store instantiations
- actions: Link between database and frontend store
- guards: Protecting routes
- landing: Non-authenticated features (landing website before sign-in)
- navigation
- signal-store: Frontend data store
- ui: Pure UI components
- assets: static files
- environments: Supabase parameter
- environments: Styles global
- Global component styles
- Polity utility styles
- TUI extensions & overwrites
- supabase: Supabase / Backend
- functions: Edge functions
- migrations: POSTGRES files organized by feature
- Schemas and other: 0000X prefix
- Database types/ Enums/Table definitions: 0000X prefix
- Schema/Table definitions: 1000X prefix
- Database functions/queries: 4000X prefix
- Database transactions (calling other functions): 6000X prefix
- Database seed: 9000X prefix
- types: Auto-generated supabase types - determining Front End types, too
- supabase.modified.ts: Overwritten supabase types since generation is not always correct
- supabase.shorthand-types.ts: Short-handed supabase types for easier usage in Front End code
- supabase.ts: Auto-generated supabase types
- copy_sql_files_to_migration_folder: A windows bat file to copy supabase files into the migration directory so that automatic migration can be executed
- package.json: Project dependencies
- cypress.config.ts: Cypress configuration
Run ng serve
for a dev server. Navigate to http://localhost:4200/
.
Run supabase start
for a local dev server. Navigate to http://localhost:54323/
. Follow the local development guide of Supabase to reset or reload your environment
npm run e2e_open
to open the Cypress test runner and execute tests without resetting your Supabase environment. Run npm run e2e_run
to run the e2e test in your command line.
PostgreSQL code and code or variables that are used to call PostgreSQL functions should be written in lowercase with underscores e.g. a_variable_for_a_postgres functions.
.
For purely frontend-related variables code camelCase is used e.g. aVariableForTheFrontend
.
HTML elements used for testing should contain the [attr.data-cy]="'element-name'"
.
In general, use speaking names and choose a longer more specific name over a short unspecific name.
Document public functions (especially in services).The project uses no unit tests so far. However, all features should be committed with a working end-to-end test.
This is not mandatory - but a guideline:
- Check naming conventions
- Document public functions
- Implement end-to-end-tests
- Pass all existing end-to-end-test to ensure code compatibility