Skip to content

jeanlescure/no-bs-typescript-server-boilerplate

Repository files navigation

Typescript plus Express

No BS Typescript (Express) Server Boilerplate

All Contributors

This boilerplate focuses on keeping configuration to a minimum yet supporting all latest Typescript features for making it as easy and worry-free as possible to get started building a performance optimized API server using Express.js.

This project is open to updates by its users, I ensure that PRs are relevant to the community. In other words, if you find a bug or want a new feature, please help us by becoming one of the contributors ✌️ ! See the contributing section.

🚨 Before continuing:

Like this project? ❤️

Please consider:

How to get started using this boilerplate

The logic of the code is structured in such a way that all you need to worry about is:

  • Creating Routes under the ./src/routes/ directory
  • Creating middlewares (if needed) under the ./src directory

The easiest way to understand how this structure works is to simply open the route defined in ./src/routes/hello-world/index.ts and start traversing up the directory structure until you reach the server.ts file at the root of this repo.

Similarly, with the middlewares in mind, open the ./src/auth/index.ts file and then the server.ts file at the root of this repo.

Running the server

I chose Rollup to handle the transpiling, compression, and any other transformations needed to get your Typescript code running as quickly and performant as possible.

There's two ways of running the server:

Development

yarn dev

Runs Rollup in watch mode which means it will hot-reload the server as you modify your source! This includes running node with the --inspect flag so you can inspect your code using Google Chrome Dev Tools (by opening chrome://inspect in your browser), you're welcome ;)

Production

yarn start

This command will first build the dist/server.js file then run it using Node. The dist file is uglified and tree-shaken so it loads/runs faster.

If you just want to build the production server without running it then run:

yarn build

What about tests?

The ethos of this boilerplate is to provide a solid foundation, from there on you are owner of your project and get to decide on the rest of the stack to build upon.

And if you're looking for a suggestion, I recommend Jest 👍

Contributing

Yes, thank you! This plugin is community-driven, most of its features are from different authors. Please update the docs and tests and add your name to the package.json file.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Jean Lescure

🚧 💻 📓 ⚠️ 💡 📖

Diana Lescure

📖 👀 🎨

About

Simple Typescript boilerplate for writing Express servers

Resources

Stars

Watchers

Forks

Packages

No packages published