Brickme

Introducing Phantom API: A Dynamic Backend System for Modern Frontend Development

As frontend developers, we often face the challenge of building and maintaining backend systems that are both flexible and efficient. Traditional backend development can be time-consuming and error-prone, especially when it comes to creating and managing APIs, database schemas, and validation rules.

That's where Phantom API comes in. Phantom API is an open-source backend system that automatically generates API endpoints, database tables, and validation schemas based on frontend API calls. This approach allows developers to focus more on building features and less on boilerplate code.


Key Features:

  • Dynamic API and Table Creation: Phantom API automatically creates RESTful API endpoints and corresponding database tables based on the data you send from the frontend. This eliminates the need for manual schema definitions and migrations.

  • Advanced Relations: The system detects relationships between entities (e.g., foreign keys) based on field names and automatically sets up the appropriate database constraints.

  • Built-in Policies: Implement role-based and attribute-based access control policies without the need for additional configuration.

  • Admin Interface: A modern React-based admin panel allows you to manage your data, view logs, and configure policies.

  • Docker-Ready Deployment: Phantom API is containerized and ready for deployment using Docker, making it easy to set up and scale.

Installation and Usage:

To get started with Phantom API, follow these steps:

1. Install Dependencies

yarn install

2. Set Up Environment Variables

Copy the example environment file and configure it:

cp .env.example .env

Edit `.env` with your configuration:

PORT=3000

NODE_ENV=development

JWT_SECRET=your-secret-key

DB_PATH=./data/phantom.db

ADMIN_EMAIL=admin@example.com

ADMIN_PASSWORD=admin123

3. Start the Services

   yarn pm2:start

This will start the backend API, admin interface, and documentation server.

4. Use the Client Package

import { setEndpoint, setToken, resource } from 'phantom-api';

setEndpoint('http://localhost:3000');

setToken('your-jwt-token');

const users = resource('User');

await users.create({ email: 'test@example.com', name: 'John Doe' });

const allUsers = await users.read();

Real-World Applications:

Phantom API is versatile and can be used in various scenarios:

  • E-commerce Platforms: Manage products, categories, and orders with ease.

  • Social Media Applications: Handle users, posts, comments, and likes seamlessly.

  • Project Management Tools: Organize tasks, projects, and teams efficiently.

  • Content Management Systems: Create and manage articles, authors, and tags effortlessly.

Documentation and Resources:

For more detailed information, check out the following resources:

Get Involved

Phantom API is an open-source project, and contributions are welcome! If you're interested in helping test, provide feedback, or contribute to the development, please visit the GitHub Repository

24 views

Add a comment

Replies

Be the first to comment