The LikDai Backend powers the core functionality of the LikDai typing tutor app — handling user authentication, typing statistics, leaderboard data, and more.
This service is built with Node.js and Express.js, offering a robust and scalable API for the LikDai frontend.
- 🔐 JWT-based Authentication: Secure user login, registration, and session management with access and refresh tokens.
- 📝 Typing Data Recording: Endpoints to save user typing session results, including WPM and accuracy.
- 📈 User Statistics & Leaderboard: Logic to calculate and retrieve user performance and rank users on a leaderboard.
- 🌐 RESTful API Endpoints: A clear and well-structured API for the frontend application to consume.
- 🗄️ PostgreSQL Integration: Uses a powerful relational database for persistent data storage.
- ⚙️ Environment-based Configuration: Easy setup and configuration using environment variables.
- 🔒 Secure Password Hashing: Utilizes
bcryptfor strong password encryption.
- Runtime: Node.js
- Framework: Express.js
- Database: PostgreSQL
- ORM: Prisma
- Authentication: JSON Web Token (JWT)
- Security: CORS, Helmet, bcrypt
- Environment Variables: Dotenv
Follow these instructions to get a local copy of the backend server up and running for development.
You need to have the following software installed on your machine:
- Node.js (v18 or later is recommended)
- npm or yarn
- PostgreSQL
-
Clone the Repository
git clone https://github.com/Lwant-02/LikDai-Server.git cd LikDai-Server -
Install Dependencies
npm install
-
Set Up the Database
- Make sure your PostgreSQL instance is running.
- Create a new database for this project (e.g.,
likdai). - Or use can use Neon Database -
https://neon.com
-
Configure Environment Variables
- Create a
.envfile in the root of the project by copying the example file:
cp .env.example .env
- Open the new
.envfile and fill in the required values, especially yourDATABASE_URLand JWT secrets.
# .env DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE" FRONTEND_URL="http://localhost:3001" PORT="8001" NODE_ENV="development" JWT_ACCESS_SECRET="your_strong_access_secret" JWT_REFRESH_SECRET="your_strong_refresh_secret" JWT_RESET_SECRET="your_strong_reset_secret" MAIL_USER="your_email@gmail.com" MAIL_PASS="your_app_specific_password" DEVELOPER_EMAIL="your_developer_email@gmail.com"
- Create a
-
Run Database Migrations
- This command uses Prisma to create the necessary tables in your database.
npx prisma migrate dev
-
Start the Server
- This command runs the server in development mode with auto-reloading.
npm run dev
The server should now be running on the port you specified (e.g.,
http://localhost:8001).
This project is fully open source. We welcome contributions of any kind — whether it’s fixing bugs, improving documentation, adding new features, or sharing ideas.
Feel free to open an issue or submit a pull request!
Thank you for being part of this open-source journey! 🚀