Skip to content

BasefloorAPIModern Backend Framework

Build powerful APIs with built-in authentication, permissions, and MongoDB integration

🚀 Quick Setup
Get a full-featured API running in minutes with minimal configuration.
BasefloorAPI({ config })
Get started
🔐 Built-in Authentication
JWT-based auth with user registration, login, and permission management.
r.post('/auth/register', { auth: false })
r.post('/auth/login', { auth: false })
r.get('/profile', { permissions: ['auth'] })
View auth docs
📊 MongoDB Integration
Seamless MongoDB integration with built-in CRUD operations and data modeling.
r.post('/users(Users)', { c: true })
Learn about models
📁 File Management
Upload, process, and serve files with support for multiple storage providers.
files: { provider: 'local' }
File handling docs
🤖 AI Integration
Built-in support for AI services including OpenAI, Anthropic, and Google AI.
ai: { openai: { apiKey }, anthropic: { apiKey } }
AI integration guide
📧 Email Services
Send emails with multiple provider support and template systems.
email: { provider: 'sendgrid' }
Email setup guide
🎤 Audio Transcription
Speech-to-text capabilities with Google Cloud Speech integration.
audio: { provider: 'google' }
Audio transcription
📄 Document Processing
Convert and process documents between different formats.
POST /files/:id/convert
Document processing
⚡ Express-based
Built on top of Express.js for maximum flexibility and performance.
API.use()
API.get()
Custom routes
🛡️ Type Safety
Full TypeScript support with comprehensive type definitions.
import { BasefloorAPI } from '@basefloor/api'
TypeScript guide
🔧 Highly Configurable
Customize every aspect through a simple configuration file.
basefloor.config.js
Configuration docs
📚 Well Documented
Comprehensive documentation with examples and best practices for every feature.
// See docs for every feature!
Browse all docs

Installation

bash
npm install @basefloor/api
bash
yarn add @basefloor/api

Quick Start

javascript
// Create basefloor.config.js
module.exports = (API) => ({
  project: {
    name: 'My API',
    port: 3000
  },
  database: {
    uri: 'mongodb://localhost:27017/myapp'
  },
  routes: (r) => [
    r.post('/users(Users)', { c: true }),
    r.get('/users(Users)', { rA: true }),
    r.get('/users/:user_id(Users)', { r: true })
  ]
})
javascript
// server.js
const BasefloorAPI = require('@basefloor/api')

const api = BasefloorAPI({
  config: require('./basefloor.config.js')
})

What is BasefloorAPI?

BasefloorAPI is the backend framework component of the Basefloor ecosystem. It's designed to be a powerful yet minimal API framework that handles all the common requirements of a modern API, allowing developers to focus on building their application's unique features rather than boilerplate code.

The Basefloor Ecosystem

  • 🏗️ BasefloorAPI (this framework) - Backend API framework with authentication, database integration, and services
  • 🎨 BasefloorApp (coming soon) - Vue.js frontend framework with components and utilities
  • ⚙️ Unified Config - Single basefloor.config.js file configures both API and App

With BasefloorAPI, you get:

  • Zero-config CRUD operations - Define models and get full REST APIs automatically
  • Built-in authentication & permissions - JWT-based auth with flexible permission rules
  • File upload & processing - Handle file uploads, conversions, and storage seamlessly
  • Email & notifications - Send emails with multiple provider support
  • AI integration - Built-in support for OpenAI, Anthropic, and other AI services
  • Database abstraction - Work with MongoDB through a simple, powerful interface
  • Extensive customization - Override and extend any part of the framework

Whether you're building a simple REST API or a complex application backend, BasefloorAPI provides the foundation you need to get started quickly and scale effectively.

Released under the MIT License.