Repository navigation
Server
The Server part of the project is made using SvelteKit, a JavaScript framework made to simplify all server actions (fetch, http protocol, ...) and related to Svelte framework.
The project data is stored only in a AWS cluster using Vercel, a deployer and web-app maintainer. The database is written in SQL using PostgreSQL framework.
The following is a representation of our database schemas :
enum UserRole {
USER
API_USER
ADMIN
}
enum Provider {
DISCORD
STEAM
SPOTIFY
}
model User {
id Int @id @unique @default(autoincrement())
username String @default("")
email String @unique
role UserRole @default(USER)
token String @unique
hashedPassword String
createdAt DateTime @default(now())
services Service[]
}
model Service {
id Int @id @unique @default(autoincrement())
providerType Provider
metadata Json?
user User? @relation(fields: [userId], references: [id])
userId Int?
}
model Program {
id Int @id @unique @default(autoincrement())
name String
actions Action[]
}
model Action {
id Int @id @unique @default(autoincrement())
programId Int?
metadata Json?
program Program? @relation(fields: [programId], references: [id])
reactions Reaction[]
}
model Reaction {
id Int @id @unique @default(autoincrement())
actionId Int?
metadata Json?
action Action? @relation(fields: [actionId], references: [id])
}
The API routes are located in /api route.
This route is made to list all current implemented services, their actions and related reactions. As of this moment, the route is currently templated and not working dynamically with our database.
This route is made to encapsulate all the authentication methods for the API user. Currently, the following methods are available :
-
/api/auth/login: Used to login the user using JWT encryption. -
/api/auth/register: Used to register the user using JWT encryption. -
/api/auth/spotify: Used to redirect the user to Spotify Authentication page
This route is made to encapsulate service routes to link the latter to the user.
The routes architecture are the following : /api/link/{service_name}
Currently, Spotify is the only service linkable.
This route is the same as Service Linking