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

remix-admin-panel

v1.0.0

Published

CLI to generate a admin panel for Remix.run

Downloads

4

Readme

Remix Admin Panel CLI (RAMP)

RAMP is a Command Line Interface tool designed to automatically generate and manage admin panel views for Remix.run applications using Prisma as an ORM.

Features

  • Automatic generation of CRUD views based on your Prisma schema
  • Smart view updates: only regenerates views that have changed
  • Customizable Handlebars templates for view generation
  • Built-in migration system to track and update generated views

Installation

To install RAMP globally, run:

npm install -g remix-admin-panel

Usage

Navigate to your Remix.run project directory and run:

ramp generate

This command will:

  1. Locate your Prisma schema file
  2. Parse the schema and extract model information
  3. Generate or update admin views in your Remix app's routes directory
  4. Create or update a manifest file to track generated views

Options

  • -s, --schema <path>: Specify the path to your Prisma schema file (optional)
  • -o, --output <directory>: Specify the output directory for generated views (optional)
  • -t, --templates <directory>: Specify a custom directory for Handlebars templates (optional)

Example with options:

ramp generate -s ./prisma/schema.prisma -o ./app/routes/admin -t ./my-templates

Customizing Templates

RAMP uses Handlebars templates to generate views. You can customize these templates to fit your project's needs:

  1. Create a new directory for your custom templates
  2. Copy the default templates from the RAMP package to your new directory
  3. Modify the templates as needed
  4. Use the -t option to specify your custom templates directory when running RAMP

Each template file should have a .hbs extension and use Handlebars syntax. The main context object passed to the templates is model, which contains the Prisma model information.

Example of a custom List template:

import { useLoaderData, Link } from "@remix-run/react";
import { json } from "@remix-run/node";
import { db } from "~/utils/db.server";

export const loader = async () => {
  const items = await db.{{model.name.toLowerCase()}}.findMany();
  return json({ items });
};

export default function {{model.name}}ListView() {
  const { items } = useLoaderData<typeof loader>();

  return (
    <div>
      <h1>{{model.name}} List</h1>
      <Link to="create">Create New {{model.name}}</Link>
      <table>
        <thead>
          <tr>
            {{#each model.fields}}
              <th>{{this.name}}</th>
            {{/each}}
            <th>Actions</th>
          </tr>
        </thead>
        <tbody>
          {items.map(item => (
            <tr key={item.id}>
              {{#each model.fields}}
                <td>{item.{{this.name}}}</td>
              {{/each}}
              <td>
                <Link to={`${item.id}/edit`}>Edit</Link>
                <Link to={`${item.id}/delete`}>Delete</Link>
              </td>
            </tr>
          ))}
        </tbody>
      </table>
    </div>
  );
}

Migration System

RAMP includes a built-in migration system to handle updates to your Prisma schema:

  • It tracks generated views using a manifest file (.ramp-manifest.json)
  • When regenerating views, it only updates those that have changed
  • This system helps preserve any manual customizations you've made to generated views

Contributing

We welcome contributions to RAMP! Here's how you can help:

  1. Fork the repository
  2. Create a new branch for your feature or bug fix
  3. Make your changes and write tests if applicable
  4. Submit a pull request with a clear description of your changes

Please ensure your code adheres to the existing style and passes all tests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.

Roadmap

  • [ ] Add a diff command to show changes before applying updates
  • [ ] Implement a backup system for existing views
  • [ ] Add support for custom migrations
  • [ ] Develop a conflict resolution system for manually modified views

We're always looking to improve RAMP. If you have ideas for new features, please let us know by creating an issue!