npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@astreak/express-ts-starter

v1.6.1

Published

Namskaram, this is a starter template for Express.js with TypeScript. It includes all the necessary packages and configurations to get started with your project. It also includes a basic user authentication system with JWT.

Downloads

10

Readme

@astreak/express-ts-starter: A Robust Express.js Starter with TypeScript

Namskaram! 🙏 Welcome to the Express.js TypeScript Starter. This project provides a solid foundation for building RESTful APIs and web applications with Express.js, leveraging the power of TypeScript for type safety and improved developer experience.

Features

  • TypeScript: Enhanced code quality, maintainability, and tooling with static typing.
  • Express.js: Minimalist and flexible web application framework for Node.js.
  • Authentication: Secure user authentication with JSON Web Tokens (JWT).
  • MongoDB Integration: Database integration using Mongoose for seamless data modeling and interaction.
  • Redis Caching: Optional integration with Redis for improved performance through data caching.
  • Morgan Logging: Configurable request logging with Morgan.
  • Helmet Security: Essential security middleware to protect against common vulnerabilities.
  • CORS Support: Easily manage Cross-Origin Resource Sharing (CORS) for your API.
  • Input Validation: Use Express Validator for robust validation of incoming request data.
  • Rate Limiting: Prevent abuse with Express Rate Limit.
  • Testing: Jest testing framework for writing unit and integration tests.

Prerequisites

Getting Started

  1. Clone the Repository:

    git clone https://github.com/theakashshukla/express-ts-starter.git
    cd express-ts-starter
  2. Install Dependencies:

    npm install
  3. Setup Environment Variables:

    Create a .env file in the root of your project and add your environment variables. You can start by copying the example file:

    cp .env.example .env
  4. Install TypeScript (if not already installed:

    npm install -g typescript
  5. Start the Development Server:

    npm run dev
  6. Production Build:

    npm run build
  7. Run Prodcution Server

     npm run start
  8. Run Tests:

    npm run test
  9. Prettier:

    npm run format

Project Structure

The project structure is designed to provide a clear and organized way to build your application. Here's an overview of the structure:

express-ts-starter/
├── src
│   ├── config
│   │   ├── dbConfig.ts
│   │   ├── index.ts
│   │   ├── redisConfig.ts
│   ├── controllers
│   │   └── userController.ts
│   ├── middlewares
│   │   ├── authMiddleware.ts
│   │   ├── authorizationMiddleware.ts
│   │   ├── rateLimit.ts
│   │   ├── validationMiddleware.ts
│   │   └── errorHandler.ts
│   ├── models
│   │   └── userModel.ts
│   ├── routes
│   │   ├── index.ts
│   │   ├── health.ts
│   │   └── userRoutes.ts
│   ├── services
│   │   ├── userService.ts
│   ├── utils
│   │   ├── authUtils.ts
│   │   ├── bcryptUtils.ts
│   │   ├── logger.ts
│   │   └── token.ts
│   |── validators
│   │   ├── userValidator.ts
│   |   └── serviceValidator.ts
│   └── app.ts
├── tests
├── .env
├── .env.example
├── .gitignore
├── jest.config.js
├── package.json
├── tsconfig.json
└── README.md

Scripts

  • npm run dev: Start the development server with Nodemon.
  • npm run build: Compile TypeScript to JavaScript.
  • npm run start: Start the production server.
  • npm run test: Run tests using Jest.
  • npm run format: Format code using Prettier.

Testing

This project uses the Jest testing framework for writing unit and integration tests. You can find the test files in the tests directory. To run the tests, use the following command:

npm run test

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request if you find a bug or want to add a new feature.

License

This project is open-source and available under the ISC License.