Quick Start

Follow these instructions to create a new Skulljs project.

Requirements

  • Git — latest source release
  • Node.js — latest LTS version or newer
  • MySQL — 8.0 version or newer
Why Git? Skulljs uses git repositories to generate the project structure.

Start a new Skulljs project

Install the CLI, create a new project, modify the backend configuration, configure database access, initialize the database, and start the app.

Install the CLI

We have created a CLI named skulljs-cli to simplify the usage of Skulljs as much as possible.

npm install --global @skulljs/cli

Create a new project

sk new <project_name>

When prompted:

Modify the backend configuration

// backend/src/configs/configuration.ts
export const configuration = () => ({
  // Api

  // general prefix for nestjs routes
  apiPrefix: "api",
  // nestjs port
  port: 3000,

  // Access Logger

  // the max size of the file before it rotates
  accessLoggerFileSize: "10M",
  // the max time before it rotates
  accessLoggerFileInterval: "1d",

  // Helmet

  // false for sk build
  helmetContentSecurityPolicy: false,

  // Cors

  // allowed origins | Ex: angular
  corsOrigins: ["http://localhost:4200"],

  // OpenApi

  // path of the open api docs
  openAPIPath: "api",
  // title of the open api docs
  openAPITitle: "skulljs nestjs example",
  // description of the open api docs
  openAPIDescription: "nestjs component for skulljs",
  // version of the open api docs
  openAPIVersion: "1.0",

  // Session

  // ! you need to change this
  sessionSecret: "changeMeOrInsecure",
  // value in ms | 1 day
  sessionCookieMaxAge: 86400000,
  // true = Forces the session to be saved back to the session store, even if the session was never modified during the request.
  sessionResave: false,
  // true = Forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified.
  sessionSaveUninitialized: false,
  // Specifies the boolean value for the HttpOnly Set-Cookie attribute.
  sessionCookieHttpOnly: false,
  // Specifies the boolean value for the Secure Set-Cookie attribute.
  sessionCookieSecure: "auto",

  // Mailer

  // Smtp Host
  mailerSmtpHost: "smtp.example.com",
  // Smtp Port
  mailerSmtpPort: 25,
  // Default from for mails
  mailerDefaultFrom: '"skulljs" <skulljs@example.com>',

  // Crypto

  // ! you need to change this, === 32 characters
  cryptoSecretKey: "changeMeOrInsecure".padEnd(32, "!"),
});

Configure database access

# ./backend/.env
DATABASE_URL="mysql://username:password@127.0.0.1:3306/skulljs"

Initialize the database

npx prisma db push
npx prisma db seed

Run the app

nestjs

npm run start:dev

Skulljs will start the angular development webserver accessible by default at http://localhost:3000. Saved changes will live reload in the browser.

angular

npm run start

Skulljs will start the angular development webserver accessible by default at http://localhost:4200. Saved changes will live reload in the browser.

Other commands

Skulljs comes with commands for common tasks. Commands →

Features

Skulljs comes with many features. Features →