npm package: @magicserver/magicserver
Description: Automatic HTTPS for any Node.js application. Fully managed TLS certificate issuance and renewal.
Author: Arsh
Latest version: 0.1.0

<div align="center">
<img width="500" height="289" alt="magicserver wordmark" src="https://github.com/magicserverjs/magicserver/blob/main/.github/assets/wordmark.png" />
</div>
<h3 align="center">Easy, automatic HTTPS</h3>
<p align="center"><i>Certificate issuance and renewal automation with intuitive usage and sensible defaults.</i></p>

<div align="center">

[![main](https://github.com/magicserverjs/magicserver/actions/workflows/test.yml/badge.svg)](https://github.com/magicserverjs/magicserver/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/magicserverjs/magicserver/blob/main/LICENSE)
[![npm version](https://badge.fury.io/js/@magicserver%2Fmagicserver.svg)](https://npmjs.org/@magicserver/magicserver)

</div>

> [!TIP]
> magicserver is in active development. Feel free to request features, share your use case, and provide feedback on ease of use. [Open discussions](https://github.com/magicserverjs/magicserver/discussions)


## Quick Start

As a library, magicserver provides platform-specific utilities for each platform it supports. After configuring DNS records, starting an automatic HTTPS server requires just a few lines of code:

```typescript
import { createMagicServer } from "@magicserver/magicserver"

const server = createMagicServer("example.com", (req, res) => {
  res.end("Hello, world!")
})
```

Here, `createMagicServer()` requests a certificate for "example.com" from Let's Encrypt, verifies ownership of the domain, and finally starts an HTTPS server that responds with "Hello, world!".

To learn more about how to use magicserver, please review our [documentation](https://magicserver.arsh.sh/docs).

## Features
- **Easy configuration** with best-practice defaults that just work.
- **Enterprise-ready** with flexibility to use a custom CA for internal names.
- **Scale** vertically and horizontally with direct access to the certificates.
- **Bloat free** with minimal dependencies and modular design.
- **HTTP/1.1** and **HTTP/2** support.

> [!IMPORTANT]  
> Interested in what I do? I am looking for full-time oppurtunities! Hi, I am Arsh. I am a serial builder addicted to difficult and impactful challenges. You can review my work on my [website](https://arsh.sh) and on my GitHub [profile](https://github.com/lilnasy). Let's [schedule an introduction](https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ3ChoWFCFbrieMOvlK_JKikkb5Lky0DQ20HBwWA2e9WfEIY5K1NKk4Iul2y3pTvwHwrZ2Oy-6ba).

## Potential Future Features
_Prioritization of features is based on user feedback. If one of these features is important to you, please [create an issue](https://github.com/magicserverjs/magicserver/issues)._
- Integration with Next.js, Remix, Nuxt, Astro, Bun, Deno, and Express
- Google, ZeroSSL, Buypass CA Authorities
- HTTP to HTTPS redirect
- Structured logging
- Serving application over insecure HTTP in addition to HTTPS
- 6 day certificates (waiting for CA support)
- Persistent accounts
- ACME Renewal Information (ARI) extension support
- IP address certificates with TLS-ALPN-01 challenge
- Wildcard domain certificates with DNS-01 challenge
- Storage of certificates to share within a fleet of servers

## Troubleshooting
For bug reports, please [open an issue](https://github.com/magicserverjs/magicserver/issues) with a minimal reproducible example. If you an run into an issue that you are unsure is a bug, please [start a discussion](https://github.com/magicserverjs/magicserver/discussions) for help.

## Code of Conduct
When interacting with other people, be kind, constructive, and respectful. We follow the Contributor Covenant 3.0 to standardize and communicate our expectations for acceptable behavior. You can read the full code of conduct [here](./CODE_OF_CONDUCT).

## Contributing
We welcome contributions of any size and skill level. You can read the full contributing guide [here](./CONTRIBUTING).

## Security
We take security seriously. We have mitigations against ongoing supply chain attacks, and a responsible disclosure policy. Please refer to [SECURITY.md](./SECURITY.md) for more information.

## License
This project is licensed under the [MIT License](./LICENSE).
Parts of magicserver are derived from the following projects:
- [TC39 Uint8Array to base64 polyfill](https://github.com/magicserverjs/magicserver/blob/9b71aad/src/arraybuffer-base64-polyfill.ts) from [TC39 proposal for Uint8Array utility methods](https://github.com/tc39/proposal-arraybuffer-base64/tree/4c79da434bd39988eaaacf6fa3ce714c7d9a57c0) ([MIT](https://github.com/tc39/proposal-arraybuffer-base64/blob/4c79da434bd39988eaaacf6fa3ce714c7d9a57c0/LICENSE))

## Changelog

See [CHANGELOG.md](./CHANGELOG.md) for a history of changes to the magicserver package.