Artur-Poffo / Testing-Bun-Runtime

Testing this new JavaScript/TypeScript Runtime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple API for user registration/authentication

Status: Finished

AboutFeaturesAPI RoutesHow it worksTech StackAuthor

About

Testing Elysia with Bun runtime - Is a simple API created to test the new runtime JavaScript/TypeScript: Bun


Features

  • Register user
  • Sign In with user
    • JWT Authentication
  • Get user profile using the JWT

API Routes

  • Users
    • POST /users/signup - Register a new user
    • POST /users/signin - Sign in with user and generate JWT
    • PATCH /users/profile - Get logged user profile

How it works

Pre-requisites

Before you begin, you will need to have the following tools installed on your machine: Git, Bun runtime. In addition, it is good to have an editor to work with the code like VSCode and a REST client like Insomnia

You will also need to have Docker installed to run the postgres database with Docker Compose

it is very important that before running the project you configure the environment variables as indicated in the file: .env.example

Run the app

# Clone this repository
$ git clone https://github.com/Artur-Poffo/Testing-Bun-Runtime.git

# Access the project folder cmd/terminal
$ cd Testing-Bun-Runtime

# install the dependencies
$ bun install

# Inicialize the database
# In the root directory after installing docker run:
$ docker compose up
# This command should create and start a container with Postgres database

# Then when you want to stop running docker run:
$ docker compose stop
# Or just press Ctrl+c

# When you want to restart, run:
$ docker compose start

# With your database running and connected in .env file:
$ bunx prisma migrate dev

# Run the application in development mode
$ bun dev

# The server will start at port: 3000 - You can now test in Insomnia or another REST client: http://localhost:3000

Run tests

# Run unit tests
$ bun test:unit

Tech Stack

The following tools were used in the construction of the project:

  • Bun runtime/toolkit
  • TypeScript
  • Elysia Framework
  • zod
  • Prisma ORM
  • @Elysia/jwt
  • @Elysia/cookie
  • @Elysia/swagger

See the file package.json


Author

  • Artur Poffo - Developer

Linkedin Badge Gmail Badge


About

Testing this new JavaScript/TypeScript Runtime


Languages

Language:TypeScript 100.0%