This is the backend API for the Falkor project, built with Elysia and Bun runtime.
- Bun (v1.0.0 or higher)
- Clone the repository
git clone https://github.com/team-falkor/api.git
cd api
- Install dependencies
bun install
- Set up environment variables
Create a .env
file in the root directory with the following variables:
DATABASE_URL="file:../data.db"
JWT_SECRET="your-secret-key-at-least-32-characters-long"
Note: Make sure your JWT_SECRET is at least 32 characters long for security.
- Set up the database
bun run db:push
To start the development server with hot reloading:
bun run dev
The API will be available at http://localhost:3000/
To start the production server:
bun run start
- Pull the latest database schema:
bun run db:pull
- Push schema changes to the database:
bun run db:push
The API uses JWT for authentication. Here's how to authenticate:
- Register a new user:
POST /auth/sign-up
- Login to get tokens:
POST /auth/login
- Use the access token in subsequent requests
- Refresh tokens when needed:
POST /auth/refresh
- Logout:
POST /auth/logout
POST /auth/sign-up
- Register a new userPOST /auth/login
- Login and get tokensPOST /auth/refresh
- Refresh access tokenPOST /auth/logout
- Logout and invalidate tokensGET /auth/me
- Get current user info
GET /achievements/steam
- Get Steam achievements
GET /plugins/providers
- Get available providers
api-elysia/
├── prisma/ # Database schema and migrations
├── src/
│ ├── @types/ # TypeScript type definitions
│ ├── handlers/ # Request handlers
│ ├── routes/ # API routes
│ ├── utils/ # Utility functions
│ └── index.ts # Main application entry point
├── .env # Environment variables (create this)
├── package.json # Project dependencies and scripts
└── tsconfig.json # TypeScript configuration
- Bun - JavaScript runtime & package manager
- Elysia - TypeScript web framework
- Prisma - Database ORM
- SQLite - Database
- @elysiajs/jwt - JWT authentication
- @elysiajs/cors - CORS support
This project is licensed under the terms of the license included in the repository.