Skip to content

monocloud/fastify-backend-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Fastify Backend Quickstart

A minimal Fastify example showing how to protect API routes with access token validation using MonoCloud.

What this repo shows

  • MonoCloud access token validation with Fastify
  • Global route protection via hooks
  • Accessing the authenticated user's claims

Built with @monocloud/backend-node.

Prerequisites

Before you begin:

  1. In the MonoCloud Dashboard, create a new API
  2. Set the Audience (for example https://api.example.com) — this uniquely identifies your API
  3. Add a scope named example-api and mark the scope as a default scope

Configure environment variables

This repo includes a .env template. Replace the placeholders with values from your API:

MONOCLOUD_BACKEND_TENANT_DOMAIN=https://<your-domain>
MONOCLOUD_BACKEND_AUDIENCE=https://<your-api-identifier>

Do not commit real secrets. This file is for local development only.

Run locally

npm install
npm start

The server starts on http://localhost:3000.

Test

curl -H "Authorization: Bearer <your-access-token>" http://localhost:3000/api/protected

📘 Learn more

🤝 Contributing & Support

Issues & Feedback

  • Use GitHub Issues for bug reports and feature requests.
  • For tenant or account-specific help, contact MonoCloud Support through your dashboard.

Security

Do not report security issues publicly. Please follow the contact instructions at: https://www.monocloud.com/contact

License

Licensed under the MIT License. See the included LICENSE file.

About

A minimal Fastify example showing how to protect API routes with access token validation using MonoCloud.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors