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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ortha/server-projects

v0.0.4

Published

Projects backend for the Ortha server — CRUD API for projects with many-to-many user-project associations, permission-based access control, and Sequelize schema definitions.

Readme

@ortha/server-projects

Projects backend for the Ortha server — CRUD API for projects with many-to-many user-project associations, permission-based access control, and Sequelize schema definitions.

Installation

Internal monorepo dependency — import directly:

import { projectsServerPlugin, projectsSchema } from '@ortha/server-projects';
import type { ProjectModel, CreateProjectBody } from '@ortha/server-projects';

Usage

Registering the plugin

import { bootstrap } from '@ortha/server-platform-bootstrap';
import { databasePlugin } from '@ortha/server-platform-database';
import { identitySchema, identityServerPlugin } from '@ortha/server-identity';
import { projectsSchema, projectsServerPlugin } from '@ortha/server-projects';

await bootstrap({
    config: bootstrapConfig,
    plugins: [
        databasePlugin({
            ...dbConfig,
            schemas: [identitySchema, projectsSchema]
        }),
        identityServerPlugin(jwtConfig),
        projectsServerPlugin()
    ]
});

Routes

| Method | Path | Auth | Permissions | Description | | ------ | ------------------- | ---- | ---------------------- | -------------------- | | POST | /api/projects | Yes | create:admin:project | Create a new project | | GET | /api/projects | Yes | — | List all projects | | GET | /api/projects/:id | Yes | — | Get project by ID | | PATCH | /api/projects/:id | Yes | update:admin:project | Update project | | DELETE | /api/projects/:id | Yes | delete:admin:project | Soft-delete project |

API Reference

Plugin & Schema

| Export | Kind | Description | | ------------------------ | ------- | ----------------------------------------------- | | projectsServerPlugin() | factory | Fastify plugin — registers project routes | | projectsSchema | schema | Sequelize SchemaDefinition for project models |

Types

| Export | Kind | Description | | ------------------- | ---- | ----------------------------------- | | ProjectModel | type | Sequelize project model type | | UserProjectModel | type | Sequelize join model (user-project) | | ProjectResponse | type | API response shape | | CreateProjectBody | type | Create request body | | UpdateProjectBody | type | Update request body |

Sequelize Models

| Model | Description | | ------------- | --------------------------------------------------- | | Project | Project record (name, slug, description, status) | | UserProject | Join table linking users to projects (many-to-many) |

Internal Structure

src/lib/
├── types/index.ts                          # Request/response types
├── schema/index.ts                         # Sequelize models (Project, UserProject)
├── projectsServerPlugin/index.ts           # Fastify plugin factory
├── controllers/                            # Route handlers (one per folder)
└── services/
    ├── index.ts                            # Barrel
    ├── utils/
    │   ├── toProjectResponse/index.ts      # Raw project → API response mapper
    │   ├── modelToJSON/index.ts            # Safe Sequelize .toJSON() wrapper
    │   └── bulkCreateSlugs/index.ts        # Bulk create junction rows
    ├── createProject/index.ts              # Create project + assign members
    ├── listProjects/index.ts               # List user's projects
    ├── getProjectById/index.ts             # Get single project by ID
    ├── updateProject/index.ts              # Update project fields + associations
    └── deleteProject/index.ts              # Soft-delete project

Key Patterns

  • Each service is a plain async function: serviceName(deps)(args).
  • UserProjectModel is a join table for many-to-many user-project associations.
  • Schema associate() wires relations to identity models via the shared ModelRegistry.
  • Routes are protected with authHook and permissionHook from @ortha/server-identity.
  • All CRUD operations are scoped to user membership.

Dependencies

  • @ortha/server-platform-databaseSchemaDefinition, ModelRegistry types
  • @ortha/server-identityauthHook, permissionHook, getRequestUser
  • @ortha/server-utils — error response builders

Building

nx build server-projects