Giter Club home page Giter Club logo

w3itch-backend's Introduction

W3itch Backend

Description

W3itch is a self-hostable application allowing you to upload/play games.

Configuration

# Generate JWT key
$ yarn keygen
# Make log directory
$ sudo mkdir -p /var/log/w3itch-backend
# Development mode only
$ cp config/config.example.yaml config/config.development.yaml
# Production mode only
$ cp config/config.example.yaml config/config.production.yaml

The config directory should look like this:

config
|____config.development.yaml  # development mode only
|____config.example.yaml
|____config.production.yaml   # production mode only
|____JWT_PRIVATE_KEY.pem
|____JWT_PUBLIC_KEY.pub

Update db & redis & storage configuration in config/config.development.yaml. For example:

app:
  name: w3itch-backend
  port: 3002
  bodyParser:
    limit: 50mb
  swagger:
    enable: true
  logger:
    loki:
      enable: true
      url: 'http://127.0.0.1:3100'

db:
  host: localhost
  port: 3306
  username: w3itch-dev
  password: w3itch-dev
  database: w3itch-dev
  charset: utf8mb4_general_ci
  timezone: Z

auth:
  jwt:
    accessTokenName: 'w3itch_access_token'
    refreshTokenName: 'w3itch_refresh_token'
    accessTokenExpires: '20m'
    refreshTokenExpires: '30d'
    issuer: https://w3itch.io
    algorithm: 'RS512'
    audience: []

  cookies:
    accessTokenPath: '/'
    refreshTokenPath: '/accounts/tokens'

  cors:
    origins:
      - '*'

cache:
  redis:
    host: '127.0.0.1'
    port: 6379
    pass:
  vcode:
    ttl: 3000 # seconds

storage:
  ipfs:
    fleek:
      # See: https://docs.fleek.co/storage/fleek-storage-js/
      apiKey: foo
      apiSecret: bar
      folder: w3itch/attachment
    gateways:
      - https://ipfs.fleek.co
  aws:
    accessKeyId:
    secretAccessKey:
    bucket:
    folder: w3itch-test/attachment
    ## Leave this empty or commented to use the default host
    ## If you want to use a custom host, you can set it here with the following format
    ## It should resolve to aws with your bucket name
    ## https://s3.amazonaws.com/{bucket}
    # customBaseUrl: https://my-custom-host/
    

blockchain:
  infura:
    apiToken: foo
  # Supported blockchain networks
  # You must add a provider for each blockchain network in web3.providers.ts
  # and enable it here in order to add a new blockchain network
  supportedChainIds: [1, 3, 4, 5, 10, 42, 56, 97, 137, 42161]

account:
  github:
    clientId: foo
    clientSecret: bar

user:
  username:
    reservedList:
      - blog
      - api
    # - etc.

Installation

$ yarn install
# migration
$ yarn typeorm migration:run

Running the app

# development
$ yarn start

# watch mode
$ yarn start:dev

# production mode
$ yarn start:prod

Test

# unit tests
$ yarn test

# e2e tests
$ yarn test:e2e

# test coverage
$ yarn test:cov

Conventional Commits

This project is following commitlint rules and checks the commit message with husky. You can also follow the Local setup installation guide to install this lint in your project, like following:

# Install and configure if needed
yarn add @commitlint/{cli,config-conventional} --dev
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js

# Install Husky
yarn add husky --dev

# Active hooks
npx husky install
# or
yarn husky install

# Add hook
npx husky add .husky/commit-msg 'npx --no-install commitlint --edit $1'
# or
yarn husky add .husky/commit-msg 'yarn commitlint --edit $1'

w3itch-backend's People

Contributors

remi-guan avatar w3itch avatar kodamasakuno avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.