npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ojus

v1.1.5

Published

[![npm version](https://img.shields.io/npm/v/ojus.svg)](https://www.npmjs.com/package/ojus) [![npm downloads](https://img.shields.io/npm/dm/ojus.svg)](https://www.npmjs.com/package/ojus) [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)]

Downloads

921

Readme

ojus

npm version npm downloads License: ISC

Lightweight, modular Node.js framework for quick API scaffolding

Table of Contents

Installation

To get started with ojus, you can install it globally using npm:

npm install -g ojus

After installation, you can use the ojus CLI to scaffold and manage your Node.js projects.

Features

  • API scaffolding: Quickly scaffold REST or GraphQL APIs with just one command.
  • Database integration: Supports MongoDB and SQL (Sequelize) out-of-the-box.
  • Modular architecture: Built using the MVC (Model-View-Controller) pattern for easy maintainability.
  • Command-line interface: A simple and intuitive CLI to scaffold new projects with minimal setup.
  • Customizable: Generate flexible folder structures and include database configurations.
  • Lightweight: Minimal dependencies for faster performance.

Quick Start

Create a new project using the ojus CLI:


ojus create my-project

During project creation, you will be prompted to choose:

  • API type: REST or GraphQL
  • Database type: MongoDB or SQL (Sequelize)

Once the project is generated, navigate into the project folder and install dependencies:


cd my-project
npm install

To start the server, run:


npm start

Project Structure

The generated project follows a modular, MVC-based structure. Here’s a typical structure for a REST API project:

my-project/
├── client/  (For frontend code)
│   ├── src/
│   │   ├── components/  (Reusable UI elements)
│   │   ├── pages/  (Route-specific components)
│   │   ├── utils/  (Utility functions)
│   │   ├── styles/  (CSS or styled-components)
│   │   └── App.js  (Root application component)
│   ├── public/  (Static assets, favicon)
│   └── index.html  (Entry point for the frontend)
├── server/  (For backend code)
│   ├── controllers/  (Business logic for API endpoints)
│   ├── models/  (Data models and database interactions)
│   ├── routes/  (API endpoints and routing configuration)
│   ├── config/  (Configuration files, e.g., database connection)
│   └── index.js  (Entry point for the backend server)
├── .env  (Environment variables for server-side configuration)
├── package.json  (Project dependencies and scripts)
└── README.md

REST API:

  • controllers/: Contains the logic for handling requests (e.g., userController.js).
  • models/: Defines data models (e.g., user.js).
  • routes/: Defines routes for the API (e.g., userRoutes.js).
  • config/: Configuration files, such as database setup.
  • app.js: Initializes the app, middleware, and routes.

GraphQL API:

  • graphql/schema.js: Defines the GraphQL schema.
  • graphql/resolvers.js: Handles GraphQL query and mutation logic.

CLI Commands

Create a New Project

ojus <project-name> 

Scaffold a new project. You'll be prompted to select:

  • API type: REST or GraphQL
  • Database: MongoDB or SQL (Sequelize)

Start the Development Server

Once inside your project directory, you can start the development server:


npm start

This command will launch the server, and it will be accessible at http://localhost:3000.

Folder Structure

By default, ojus generates a project with the following structure:

  • controllers/: Business logic for API requests.
  • models/: Database models for either MongoDB or Sequelize.
  • routes/: Route handlers for your API endpoints.
  • graphql/: Contains the GraphQL schema and resolvers (if GraphQL was selected).
  • config/: Stores database and other configuration files.

Custom Configuration

You can modify environment variables using the .env file in your project’s root directory. Typical values include:

PORT=3000
DATABASE_URL=mongodb://localhost:27017/mydatabase

Core Dependencies

  • Express.js: Web framework for handling API routes.
  • Mongoose: ODM for MongoDB integration.
  • Sequelize: ORM for SQL-based databases (optional, if SQL is selected).
  • GraphQL: If GraphQL is selected, provides a schema-first API layer.
  • dotenv: For environment variables and configuration.

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch with your feature or bug fix.
  3. Submit a pull request with detailed information about the changes.

Please follow the coding standards and include relevant tests for any new functionality