https://github.com/alessandroannini/node-tmpl
Node server template
https://github.com/alessandroannini/node-tmpl
axios express nodejs pino typescript zod
Last synced: about 1 month ago
JSON representation
Node server template
- Host: GitHub
- URL: https://github.com/alessandroannini/node-tmpl
- Owner: AlessandroAnnini
- Created: 2024-09-26T12:40:08.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-25T16:01:52.000Z (5 months ago)
- Last Synced: 2025-03-18T02:24:51.949Z (about 1 month ago)
- Topics: axios, express, nodejs, pino, typescript, zod
- Language: TypeScript
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node API Template
- Node
- TypeScript
- Express
- Axios
- Pino
- ZodTo install dependencies:
```bash
npm install
```To run:
```bash
npm start
```## Project features
- error handling middleware
- logging middleware using Pino
- validation middleware using Zod
- different routes for different API versions
- controller for each route
- modular design
- fully typed Zod-TypeScript schema## Axios client features
- Automatic token management (fetching, storing, and refreshing)
- Custom header support through a generator function
- Automatic token renewal before expiration (60-second buffer)
- Request interceptor for ensuring valid tokens on each request
- Response interceptor for handling 401 errors and token refresh
- Automatic request retry after token refresh
- Error handling and logging
- TypeScript support with type definitions
- Configurable base URL for external service
- OAuth 2.0 / OpenID Connect token acquisition