Skip to content

Boilerplate template structure library how add logic api, improve your errors and config headers

License

Notifications You must be signed in to change notification settings

monzter50/boilerplate-api-core-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Boilerplate API Core Library - Monorepo

npm version TypeScript License: MIT Test Coverage CI

A comprehensive monorepo containing HTTP client libraries for modern TypeScript applications. This repository includes packages for both browser and Node.js environments with built-in retry logic, authentication, and comprehensive error handling.

πŸ“¦ Packages

This monorepo contains the following packages:

Package Version Description
boilerplate-api-core-library npm Universal HTTP client library

✨ Features

  • πŸ—οΈ Monorepo Architecture: Organized using Yarn workspaces and Turbo
  • 🌍 Universal Packages: Works in both browser and Node.js environments
  • πŸ”’ Type-Safe: Full TypeScript support with comprehensive type definitions
  • πŸ”„ Retry Logic: Configurable retry mechanism with exponential backoff
  • πŸ” Authentication: Built-in support for token-based authentication
  • ⚑ Performance: Optimized for speed and minimal bundle size
  • πŸ›‘οΈ Error Handling: Comprehensive error handling with custom error types
  • 🎯 Simple API: Clean and intuitive API design
  • πŸ“¦ Minimal Dependencies: Optimized production dependencies
  • πŸš€ Automated Releases: CI/CD with Changesets for version management

πŸš€ Quick Start

Installation

# npm
npm install boilerplate-api-core-library

# yarn
yarn add boilerplate-api-core-library

# pnpm
pnpm add boilerplate-api-core-library

Basic Usage

import { api } from 'boilerplate-api-core-library/client';

// For browser environments
const { response, status } = await api.get({
  url: 'https://api.example.com/users',
  contentType: 'application/json'
});

For detailed usage examples, see the Core Package Documentation.

πŸ—οΈ Monorepo Structure

β”œβ”€β”€ packages/
β”‚   └── core/                   # Core HTTP client library
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ client/         # Browser-specific implementations
β”‚       β”‚   β”œβ”€β”€ server/         # Node.js-specific implementations
β”‚       β”‚   β”œβ”€β”€ core/           # Shared core functionality
β”‚       β”‚   └── types/          # TypeScript type definitions
β”‚       └── README.md
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ client/                 # Browser usage examples
β”‚   └── server/                 # Node.js usage examples
β”œβ”€β”€ .github/
β”‚   └── workflows/              # CI/CD workflows
β”‚       β”œβ”€β”€ release.yml         # Automated releases
β”‚       └── pull_request_checks.yml  # PR quality checks
└── docs/                       # Documentation

## 🎯 Examples

Check out the [`examples`](./examples) directory for complete working examples:

- **[Browser Example](./examples/client/)**: Web application usage with HTML/JS
- **[Node.js Example](./examples/server/)**: Server-side usage with TypeScript

### Running Examples

```bash
# Server example
yarn example:server

# Client example (builds and serves)
yarn example:client:build
yarn example:client:serve

πŸ› οΈ Development

Prerequisites

  • Node.js >= 18
  • Yarn >= 1.22.1

Setup

# Clone the repository
git clone https://github.com/monzter50/boilerplate-api-core-library.git
cd boilerplate-api-core-library

# Install dependencies
yarn install

# Build all packages
yarn build

Available Scripts

Command Description
yarn build Build all packages
yarn test Run tests for all packages
yarn test:coverage Run tests with coverage
yarn lint Lint all packages
yarn format Format code with Prettier
yarn type-check Run TypeScript type checking
yarn clean Clean build artifacts
yarn dev Development mode with watch

Release Process

This monorepo uses Changesets for version management and automated releases:

# 1. Create a changeset for your changes
yarn changeset

# 2. Version packages (updates CHANGELOG and package.json)
yarn changeset:version

# 3. Commit and push - CI will handle the release
git add .
git commit -m "chore: version packages"
git push

CI/CD

  • Pull Requests: Automated quality checks (tests, linting, type checking)
  • Main Branch: Automated releases when changesets are detected
  • Workflows: Located in .github/workflows/

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Fork and clone the repository
  2. Install dependencies: yarn install
  3. Run tests: yarn test
  4. Build the project: yarn build

πŸ“„ License

MIT Β© Monster Codes

πŸ™ Acknowledgments

  • Inspired by modern HTTP client libraries
  • Built with TypeScript and modern JavaScript features
  • Designed for universal usage across environments

Star ⭐ this repo if you find it helpful!

About

Boilerplate template structure library how add logic api, improve your errors and config headers

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •