0.1.0-alpha.4 • Published 12 months ago

colony-analytics-api v0.1.0-alpha.4

Weekly downloads
-
License
-
Repository
github
Last release
12 months ago

Documentation

Development quickstart

  1. Duplicate .env.example and rename it to .env.
  2. Set the environment variables.
  3. Run bun install.
  4. Run bun dev.
  5. Run bun studio in a separate shell to use Drizzle Studio.
  6. 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

FieldTypeUnique?Nullable?Description
idTextYes (primary key)NoAuto-generated Nano ID
usernameTextYesNoAllows alphanumeric characters alongside _ and .
passwordSaltTextNoNo16-character-long hexadecimal
passwordHashTextNoNoPBKDF2 hash
accessBooleanNoNoDetermines 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.

RouteMethodEndpointDescription
Sign upPOST/authentication/sign-upCreates a new user
Sign inPOST/authentication/sign-inReturns a JWT token if the sign-in attempt is successful
VerifyGET/authentication/verifyRetrieves the user's details if the JWT token is valid

data router

The authentication router handles analytics data routes. It has a /data prefix.

RouteMethodEndpointDescription
IndexGET/dataRetrieves the main anayltics data if the JWT token is valid
ClaimsGET/data/claimsRetrieves the claims anayltics data if the JWT token is valid
Tokenized ItemsGET/data/tokenized-itemsRetrieves the tokenized items anayltics data if the JWT token is valid
ConfigurationGET/data/configurationRetrieves the anayltics configuration if the JWT token is valid