0.1.0-alpha.4 • Published 1 year ago
colony-analytics-api v0.1.0-alpha.4
Documentation
Development quickstart
- Duplicate
.env.exampleand rename it to.env. - Set the environment variables.
- Run
bun install. - Run
bun dev. - Run
bun studioin a separate shell to use Drizzle Studio. - You are ready to start developing.
Database documentation
This project utilizes Drizzle ORM and PostgreSQL for mapping and managing data. You can find the documentation for each table below.
users table
| Field | Type | Unique? | Nullable? | Description |
|---|---|---|---|---|
id | Text | Yes (primary key) | No | Auto-generated Nano ID |
username | Text | Yes | No | Allows alphanumeric characters alongside _ and . |
passwordSalt | Text | No | No | 16-character-long hexadecimal |
passwordHash | Text | No | No | PBKDF2 hash |
access | Boolean | No | No | Determines whether the user can access the app |
Router documentation
This project utilizes Elysia for routing and handling requests. You can find the documentation for each router below.
authentication router
The authentication router handles authentication-related routes. It has a /authentication prefix.
| Route | Method | Endpoint | Description |
|---|---|---|---|
| Sign up | POST | /authentication/sign-up | Creates a new user |
| Sign in | POST | /authentication/sign-in | Returns a JWT token if the sign-in attempt is successful |
| Verify | GET | /authentication/verify | Retrieves the user's details if the JWT token is valid |
data router
The authentication router handles analytics data routes. It has a /data prefix.
| Route | Method | Endpoint | Description |
|---|---|---|---|
| Index | GET | /data | Retrieves the main anayltics data if the JWT token is valid |
| Claims | GET | /data/claims | Retrieves the claims anayltics data if the JWT token is valid |
| Tokenized Items | GET | /data/tokenized-items | Retrieves the tokenized items anayltics data if the JWT token is valid |
| Configuration | GET | /data/configuration | Retrieves the anayltics configuration if the JWT token is valid |