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 🙏

© 2025 – Pkg Stats / Ryan Hefner

jidan_starter

v1.0.2

Published

My Express TypeScript App

Downloads

193

Readme

🎯 Project Setup Guide


📌 1. Database Preparation

Before running the project, ensure that the MySQL database is properly configured. 🔹 Check the migration file in migration/../migration.sql and adjust it if necessary. 🔹 Configure .env with MySQL connection details matching your server environment.


🛆 2. Install Dependencies

Run the following command to install all required dependencies:

npm install

⚙️ 3. Generate Prisma Client

After installing dependencies, run the following command to generate the Prisma Client:

npx prisma generate

🛠️ 4. Synchronize Database with Prisma

To ensure the database schema matches Prisma, execute the following commands:

npx prisma db push
npx prisma db pull

👉 db push applies the Prisma schema to the database. 👉 db pull retrieves the schema from the database if any changes were made.


🔍 5. Check Database Connection

Use the following command to verify the database connection:

npx ts-node src/config/dbCheck.ts

👌 If the connection is successful, proceed to the next step.


🚀 6. Run the Project

Once all configurations are complete, start the server with:

npm run dev

🎉 If successful, the server will be available at http://localhost:3000.


🔗 API Endpoints

👤 User Management

  • 💚 Create a new user:

    POST http://localhost:3000/api/users

    Request Body:

    {
      "username": "jojo",
      "email": "[email protected]",
      "password": "1234578A@"
    }
  • 🔑 User login:

    POST http://localhost:3000/api/users/login

    Request Body:

    {
      "email": "[email protected]",
      "password": "1234578A@"
    }

    Response:

    {
        "message": "Login successful",
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxLCJlbWFpbCI6ImpvaG5AZXhhbXBsZS5jb20iLCJ1c2VybmFtZSI6Impvam8iLCJpYXQiOjE3NDExMzUyMzEsImV4cCI6MTc0MTIyMTYzMX0.JjIYECNDcr1hS5TH1eRJwTFwR8ZbzRfeYMyQtWxy0KE",
        "user": {
            "user_id": 1,
            "username": "jojo",
            "email": "[email protected]"
        }
    }
  • 📃 Retrieve all users (requires authentication):

    GET http://localhost:3000/api/users/

    Authorization: Bearer Token

  • 👤 Retrieve a user by ID (requires authentication):

    GET http://localhost:3000/api/users/10

    Authorization: Bearer Token

  • ✏️ Update a user by ID (requires authentication):

    PUT http://localhost:3000/api/users/10

    Authorization: Bearer Token

  • 🛢️ Soft delete a user (set is_deleted column to true, requires authentication):

    DELETE http://localhost:3000/api/users/soft/6

    Authorization: Bearer Token

  • Delete a user permanently (requires authentication):

    DELETE http://localhost:3000/api/users/6

    Authorization: Bearer Token


📚 API Usage Instructions

  1. 📝 Create an account first using the POST /api/users endpoint.
  2. 🔒 Login using the POST /api/users/login endpoint to obtain a Bearer Token.
  3. ⚡ Use the Bearer Token to access the following endpoints:
    • GET (Retrieve all users or a specific user by ID)
    • PUT (Update user information)
    • DELETE (Soft delete a user)
    • DELETE (Permanently delete a user)

🔒 How to Use Bearer Token in Authorization

When making API requests that require authentication, include the Bearer Token in the request header:

Authorization: Bearer YOUR_TOKEN_HERE

Example using cURL:

curl -X GET "http://localhost:3000/api/users" -H "Authorization: Bearer YOUR_TOKEN_HERE"

⚠️ Notes

🚀 Ensure MySQL is running before starting the project. 🚀 If there are schema changes, always run:

npx prisma generate
npx prisma db push

📉 Security Reminder: Do not expose your .env file in public repositories.

📄 Happy Coding & Enjoy! 🚀