Repository for the Hackin2 API, built using Express.js
with Typescript
. The API serves as the backend service for the Hackin2 web application, which is a platform that connects cybersecurity freelancers and companies in look for one. It is designed to work in conjunction with a React + Vite
frontend client, PostgreSQL
database and Redis
cache storage, to provide a seamless user experience.
Hackin2 is a platform that helps companies and cybersecurity freelancers connect. This repository contains the backend API, which provides the necessary endpoints for the Hackin2 web application to interact with the database, cache storage, handle user authentication, authorization and manage security-related tasks.
- User authentication and authorization with
JWT
andSessions
. - Role base access control:
COMPANY
,PENTESTER
. - Programs management and tracking.
- Findings reporting and management.
- Security event logging and monitoring (TBD)
- User activity and access control.
- Customizable configuration options.
To run the API locally, you need the following prerequisites:
- git
- Node.js (version >= 20)
- npm
-
Clone this repository to your local machine:
git clone https://github.com/cammarb/hackin2-api.git cd hackin2-api
-
Install the dependencies
npm install
You can setup the project manually or by opening the devcontainer enviroment
This section assumes you know how to work with docker.
-
Generate private/public keys
- MacOS/Linux
.generate_keys.sh
- MacOS/Linux
-
Create docker images with compose
Run this command in your terminal
docker compose up -d
-
Create .env file
Before running the API, you need to set up the configuration. Copy the .env.example file and rename it to .env, then fill in the appropriate values for the environment variables
Dev Containers will allow you to open the project in a docker container, creating the database for you, setting up the necessary extensions in VSCode and generating the .env
as well as the key pairs for jwt
.
- Open the project in VSCode
- Install the extension
Dev Containers
- Open the command palette by pressing [Ctrl + Shift + P] (Windows/Linux) or [Cmd + Shift + P] (MacOS)
- Search for: Dev Containers: Open Folder in Container... and select that option
- VSCode will create the container for you and install all of the requirements and dependencies
# To create/update the PostgreSQL database
npx prisma db push
# To populate the database with the seed file
npx prisma db seed
npm run dev