monobase-server
TypeScript icon, indicating that this package has built-in type declarations

0.0.15 • Public • Published

Monobase Server

Monobase Server is an open-source database and server system designed to be similar to Firebase but using MongoDB as the database on a pre-configured Express server. This platform includes React for the user interface (UI), Mongoose for database management, and Socket.io for real-time communication.

Key Features

  • MongoDB Database: Utilizes MongoDB as the data storage system, providing exceptional scalability and flexibility for your applications.

  • Express.js: Built on Express.js, a popular web application framework for Node.js, making server setup and customization easy.

  • React-based User Interface: Monobase Server integrates React for creating a dynamic and responsive user interface.

  • Runtime Mongoose Model Management: Allows easy creation of Mongoose schemas through a user interface and builds Mongoose models at runtime for efficient querying.

  • REST API and Socket.io: Provides access to information through both a REST API and Socket.io, enabling real-time communication between the client and server.

Installation

To get started with Monobase Server in your project, you can easily install it via npm:

npm install monobase-server

Usage

To use Monobase Server in your application, follow these steps:

  1. Import Monobase Server in your application:

    const { MonoServer } = require("monobase-server");
  2. Configure and customize Monobase Server options to fit your needs:

    const server = new MonoServer({
     __dirname,
     secretAuth: process.env.SECRET_TOKENT as string,
     secretVerify: process.env.SECRET_VERIFY as string,
     apiKey: process.env.APIKEY as string,
     logs: console.log
    });
  3. Start Monobase Server on your Express server:

    // Important: Listen to the server with the specified configuration
     server.listen({
         version: "v1", // Server version
    
         server: {
             hostname: "localhost", // Server hostname (may be a different value in production)
             port: process.env.PORT as unknown as number // Port the server will run on
         },
    
         mongodb: {
             /*
             // Production MongoDB connection data
             */
             production: {
                 username: process.env.MONGO_USERNAME as string, // MongoDB username
                 password: process.env.MONGO_PASSWORD as string, // MongoDB password
                 cluster: process.env.MONGO_CLUSTER as string, // MongoDB cluster
                 dbname: process.env.MONGO_DBNAME as string // MongoDB database name
             },
    
             /*
             // Local (development) MongoDB connection data
             */
             local: {
                 hostname: "localhost", // Local MongoDB host name
                 port: 27017, // Port for MongoDB in the local environment
                 dbname: "monobase" // Local MongoDB database name
             }
         },
    
         socket: {
             apiKey: process.env.APIKEY_SOCKET as string, // Socket API key
             secret: process.env.SECRET_SOCKET as string // Socket secret for authentication
         }
     });

We hope Monobase Server proves to be a valuable tool for your project! If you have any questions or encounter any issues, don't hesitate to contact us at [contact@youremail.com]. Thank you for using Monobase Server!

Package Sidebar

Install

npm i monobase-server

Weekly Downloads

3

Version

0.0.15

License

MIT

Unpacked Size

14.5 MB

Total Files

235

Last publish

Collaborators

  • elkincp5