New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

create-react-serve

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-react-serve

CLI tool for bootstrapping new ReactServe applications

latest
npmnpm
Version
0.3.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

My ReactServe Auth App

A backend API with authentication built with ReactServe - a React-style framework for building APIs with JSX.

Features

  • 🔐 JWT-based authentication
  • 👤 User registration and login
  • 🔒 Protected routes with middleware
  • 💾 Prisma ORM for database operations
  • ✅ Request validation with Zod
  • 🛡️ Password hashing with bcrypt

Getting Started

1. Install dependencies

npm install

2. Set up the database

# Generate Prisma client
npm run db:generate

# Push the schema to the database
npm run db:push

# (Optional) Seed the database
npm run db:seed

3. Start the development server

npm run dev

Your API will be running at http://localhost:4000

Available Endpoints

Public Routes

  • POST /auth/signup - Register a new user
  • POST /auth/login - Login and get JWT token
  • GET /users - List all users
  • GET /users/:id - Get user by ID

Protected Routes (Require Authentication)

  • GET /auth/me - Get current user profile
  • PUT /auth/profile - Update profile

Authentication

To access protected routes, include the JWT token in the Authorization header:

Authorization: Bearer <your_jwt_token>

Example: Sign Up

curl -X POST http://localhost:4000/auth/signup \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "name": "John Doe",
    "password": "securepassword123"
  }'

Example: Login

curl -X POST http://localhost:4000/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "securepassword123"
  }'

Example: Get Current User

curl http://localhost:4000/auth/me \
  -H "Authorization: Bearer <your_jwt_token>"

Project Structure

src/
  index.tsx           # Main application file
  config.ts           # Configuration and Prisma client
  auth.ts             # Authentication utilities
  middleware.tsx      # Auth middleware
  routes/
    auth.tsx          # Auth routes (signup, login, me, profile)
    users.tsx         # User routes (list, get by id)
prisma/
  schema.prisma       # Database schema
  seed.ts             # Database seeding script

Environment Variables

Create a .env file in the root directory:

DATABASE_URL="file:./dev.db"
JWT_SECRET="your-super-secret-jwt-key-change-this-in-production"
PORT=4000

Scripts

  • npm run dev - Start development server with hot reload
  • npm run build - Build the application
  • npm run start - Start production server
  • npm run typecheck - Run TypeScript type checking
  • npm run db:generate - Generate Prisma client
  • npm run db:push - Push schema changes to database
  • npm run db:migrate - Create and run migrations
  • npm run db:studio - Open Prisma Studio
  • npm run db:seed - Seed the database with sample data

Learn More

Keywords

react-serve

FAQs

Package last updated on 07 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts