Skip to content

A Fastify server leveraging SWC for transpilation and Jest for testing.

License

Notifications You must be signed in to change notification settings

mattfsourcecode/fastify-swc-typescript-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fastify SWC TypeScript Server

Overview

This project utilizes Fastify, TypeScript, and SWC to create a robust and efficient server. Fastify's scalability, TypeScript's strong typing and advanced features, and SWC's transpilation contribute to the server's performance. Notably, the typescript package is not a dependency, as SWC handles the transpilation independently. In development mode, the server updates quickly to reflect changes in source files or tests. In production, it operates on optimized JavaScript.

This server template offers a highly advantageous platform for the swift development of serverless functions, which are integral to modern cloud-based applications. These functions, executed in cloud environments, absolve developers from the complexities of managing server infrastructure, concentrating instead on coding. They react to events, such as HTTP requests or database changes, and automatically scale with the demand, making them ideal for fluctuating workloads.

Scripts

Install

Installs the project dependencies.

pnpm i

Dev

Runs the server in development mode. The server immediately updates to reflect changes made to the source files and tests.

pnpm run dev

Test

Runs the Jest test suite.

pnpm run test

Build

Transpiles the TypeScript source files to JavaScript using SWC. The output is saved in the dist directory.

pnpm run build

Start

Runs the transpiled JavaScript code in the dist directory.

pnpm run start

Dependencies

Main Dependencies

  • fastify: The Fastify web framework for building efficient and scalable Node.js server-side applications.

Development Dependencies

  • @swc-node/jest: A Jest transformer using SWC, used for running the Jest test suite.
  • @swc-node/register: Allows on-the-fly transpilation of TypeScript to JavaScript using SWC in development mode.
  • @swc/cli: The command-line interface for SWC.
  • @swc/core: The core SWC library.
  • @swc/helpers: A set of helper functions used by SWC.
  • @types/jest: TypeScript definitions for Jest.
  • @types/node: TypeScript definitions for Node.js.
  • jest: A JavaScript testing framework.
  • nodemon: A utility that monitors for any changes in your source and automatically restarts your server.
  • ts-node: A TypeScript execution environment and REPL for Node.js, used for interpreting the TypeScript Jest configuration file.

About

A Fastify server leveraging SWC for transpilation and Jest for testing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published