/rocketseat-fastify-api

REST API coded with Fastify on Module 3 of Rocketseat MBA

Primary LanguageTypeScript

Rocketseat Fastify REST API

How to run

  1. run nvm use (or install the version set on .nvmrc)
  2. run npm i
  3. run npm run knex -- migrate:latest
  4. run npm run dev

Requisites:

RF

  • User can create a new transaction
  • User can obtain his account info
  • User can list all past transactions
  • User must be able to visualize a single transaction

RN

  • Transaction can be of credit type which will sum to the total value
  • Transaction can be of debit type which will subtract from the total value
  • It must be possible to identify users between the requests
  • User can only visualize transactions he created

Tools:

  • HTTP Server

    • Fastify - a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture
  • Database

    • Knex.js - is a "batteries included" SQL query builder for PostgreSQL, CockroachDB, MSSQL, MySQL, MariaDB, SQLite3, Better-SQLite3, Oracle, and Amazon Redshift designed to be flexible, portable, and fun to use.
    • Sqlite3 - a wrapper library written in Typescript with ZERO dependencies that adds ES6 promises and SQL-based migrations API to sqlite3.
  • Schemas validations

    • Zod - TypeScript-first schema validation with static type inference
  • Tests

    • Vitest - a next generation testing framework powered by Vite
    • Supertest - a high-level abstraction for testing HTTP, while still allowing you to drop down to the lower-level API provided by superagent.
  • Compile & Bundle

    • TSX - tsx stands for TypeScript Execute and it's a Node.js enhancement to run TypeScript.
    • TSUP - bundle your TypeScript library with no config, powered by esbuild.
  • Deploy

    • Render - is a unified cloud to build and run all your apps and websites with free TLS certificates, global CDN, private networks and auto deploys from Git.