Skip to content

The PsySec Forge for server projects. Uses Fastify, esbuild, uvu, dotenv, and TypeScript to build secure HTTP servers quickly.

Notifications You must be signed in to change notification settings

PsySecGroup/forge-server

Repository files navigation

Server Forge

The PsySec Forge for server projects. Uses Fastify, esbuild, uvu, dotenv, and TypeScript to build secure HTTP servers quickly. We support the following features right out the box:

New Project

To create a new project that uses the forge-server, run the following:

curl -s -O https://raw.githubusercontent.com/PsySecGroup/forge-server/main/create.sh && ./create.sh

Then modify the routes in src/routes.ts and use the commands above to test out your new server.

Updating Project

As we add new featuers to the forge-server, you'll want to update them and bring them to your project. Run the following command to do so:

npm update @psysecgroup/forge-server

Commands

  • npm start: Runs the compiled standalone HTTP server.
  • npm run dev: Runs the source code and recompiles on code changes.
  • npm run lint: Checks if your code is throwing syntax errors.
  • npm run test: Runs tests on your code to make sure it's working.
  • npm run build: Builds your TypeScript to a single JavaScript distribution.
  • npm run compile: Lints, tests, and builds your JavaScript distribution.

Development

import { startHttp } from '@psysecgroup/forge-server'
import { setRoutes } from './routes'

async function main () {
  await startHttp(setRoutes)
}

main()

We even have a default endpoint to test uploads. You can try it out with:

// curl -X POST -F 'file=@/path/to/file' http://localhost:3000/upload

The result will be the path where the file was saved.

Deployment

To prepare a deployment:

  • Run npm run compile
  • Create a server folder on your destination.
  • In that folder, make two more folders: assets and dist
  • Copy dist/index.js to the destination's dist folder
  • Copy the contents of your assets folder to the destination's assets folder
  • From the destination's server folder, run the HTTP server with node index.js

Research

About

The PsySec Forge for server projects. Uses Fastify, esbuild, uvu, dotenv, and TypeScript to build secure HTTP servers quickly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published