Skip to content

RzMY/LiteQueue

Repository files navigation

LiteQueue

LiteQueue is a local-first queue management system for solo developers and small teams. It runs on SQLite, keeps setup lightweight, and combines ticketing with a flexible form engine that can calculate wait time and display contextual hints.

LiteQueue 是一个面向个人开发者和小团队的本地优先排队系统。它基于 SQLite 运行,部署轻量,同时把工单管理与灵活表单引擎结合起来,可以自动计算等待时间并展示上下文提示。

项目简介 / Overview

中文:LiteQueue 面向门店、工作室、技术支持台和小型服务窗口。它支持自定义字段、动态选项提示、队列位置查询和管理后台,适合需要快速落地的本地排队场景。

English: LiteQueue is designed for counters, studios, support desks, and small service queues. It supports custom fields, dynamic hints, queue position lookup, and an admin dashboard for fast local deployment.

功能特性 / Features

  • 动态表单引擎 / Dynamic form engine for custom ticket fields.
  • 自动计算工单预计耗时 / Automatic ticket time aggregation.
  • 队列摘要与排队位置查询 / Queue summary and position lookup.
  • 工单状态管理 / Ticket status management with pending, done, and canceled states.
  • 管理后台配置管理 / Admin-side configuration management and activation.
  • 本地 SQLite 开箱即用 / Local SQLite setup with minimal dependencies.

截图 / Screenshots

首页 / Home

首页截图

展示当前排队人数、预计等待时间和公告内容。 / Shows current queue size, estimated wait time, and announcements.

提交工单 / Submit Ticket

提交工单截图

展示动态表单与提交结果。 / Shows the dynamic form and submission result.

登录 / Login

登录截图

管理员登录入口。 / Admin login entry point.

管理后台 / Admin

管理后台截图

工单表格与操作区。 / Ticket table and action area.

配置管理 / Config

配置管理截图

配置版本、激活状态与编辑入口。 / Configuration versions, activation state, and edit entry points.

技术栈 / Tech Stack

  • Next.js 14
  • React 18
  • TypeScript
  • Prisma
  • SQLite
  • Tailwind CSS

快速开始 / Quick Start

Windows / PowerShell

Copy-Item .env.example .env.local
npm install
npm run prisma:generate
npm run prisma:migrate
npm run prisma:seed
npm run dev

Open http://localhost:3000 after the server starts.

启动后访问 http://localhost:3000。

环境变量 / Environment Variables

变量 / Variable 默认值 / Default 说明 / Description
DATABASE_URL file:./dev.db Prisma 使用的 SQLite 数据库文件。 / SQLite database file used by Prisma.
NEXT_PUBLIC_POSITION_POLL_INTERVAL_MS 30000 首页“我的排队位置”自动刷新间隔,单位毫秒。 / Auto-refresh interval for the My Position widget, in milliseconds.
NEXT_PUBLIC_ADMIN_POLL_INTERVAL_MS 30000 管理页工单表格自动刷新间隔,单位毫秒。 / Auto-refresh interval for the admin tickets table, in milliseconds.
ADMIN_PASSWORD admin123 管理员验证密码。 / Admin verification password.

数据库迁移与种子 / Database Migrations & Seed

中文:npm run prisma:migrate 会使用当前 schema 和 migrations 初始化或更新本地 SQLite 数据库,npm run prisma:seed 会写入默认配置。修改 schema 后,请先执行 npm run prisma:generate

English: npm run prisma:migrate initializes or updates the local SQLite database using the current schema and migration history, and npm run prisma:seed loads the default configuration. After schema changes, run npm run prisma:generate first.

默认种子会创建名为“代理软件选择”的配置,便于你直接演示首页、提交页和管理后台。

The default seed creates a configuration named “代理软件选择” so you can demonstrate the home page, submission flow, and admin dashboard immediately.

API 总览 / API Reference

Method Path 说明 / Description
GET /api/config 获取当前激活配置。 / Get the active configuration.
GET /api/configs 列出所有配置。 / List all configurations.
POST /api/configs/create 创建新配置版本。 / Create a new configuration version.
POST /api/configs/:id/activate 激活指定配置。 / Activate a specific configuration.
POST /api/tickets 提交工单,传入 answers。 / Create a ticket from answers.
GET /api/tickets 列出最近工单。 / List recent tickets.
GET /api/tickets/:id 获取工单详情。 / Get ticket details.
PATCH /api/tickets/:id 更新工单状态,支持 pending、done、canceled。 / Update ticket status.
DELETE /api/tickets/:id 删除工单。 / Delete a ticket.
GET /api/tickets/summary 获取待处理工单摘要。 / Get the pending queue summary.
GET /api/tickets/position?ticketId=... 查询工单排队位置。 / Look up a ticket's queue position.
POST /api/admin/verify 验证管理员密码。 / Verify the admin password.

管理后台 / Admin Dashboard

管理后台位于 /admin,支持配置管理、配置激活、工单查看、状态更新、自动刷新、手动刷新、过滤、排序和分页。

The admin dashboard lives at /admin and supports configuration management, configuration activation, ticket review, status updates, auto refresh, manual refresh, filtering, sorting, and pagination.

默认管理员密码来自 .env.local 中的 ADMIN_PASSWORD。前端与后端都会读取同一个值。

The default admin password comes from ADMIN_PASSWORD in .env.local. The frontend and backend use the same value.

常见问题 / FAQ

为什么管理员登录失败? / Why does admin login fail?

请检查 .env.local 中的 ADMIN_PASSWORD 是否与前端输入一致。默认值是 admin123。 / Check whether ADMIN_PASSWORD in .env.local matches the value you enter. The default is admin123.

为什么迁移命令报错? / Why does the migration command fail?

先确认 DATABASE_URL 指向当前项目的 SQLite 文件,例如 file:./dev.db。如果 schema 改动较大,请先运行 npm run prisma:generate,再执行迁移。 / Confirm that DATABASE_URL points to the current SQLite file, such as file:./dev.db. If the schema changed significantly, run npm run prisma:generate first, then rerun migrations.

为什么页面更新不够快? / Why does the page update slowly?

检查 NEXT_PUBLIC_POSITION_POLL_INTERVAL_MSNEXT_PUBLIC_ADMIN_POLL_INTERVAL_MS。数值越小,刷新越频繁。 / Check NEXT_PUBLIC_POSITION_POLL_INTERVAL_MS and NEXT_PUBLIC_ADMIN_POLL_INTERVAL_MS. Smaller values refresh more frequently.

可以直接在 Vercel 上长期使用 SQLite 吗? / Can SQLite be used long-term on Vercel?

不建议。SQLite 依赖本地文件,而 Vercel 的运行环境是无状态的。生产环境建议切换为可持久化数据库。 / Not recommended. SQLite depends on a local file, while Vercel runs in a stateless environment. Use a persistent database for production.

贡献指南 / Contributing

  1. 保持文档与脚本一致。 / Keep documentation aligned with package scripts.
  2. 提交前运行 npm run build。 / Run npm run build before committing.
  3. 新增配置、API 或截图时,优先保持中英双语同步更新。 / When adding configs, APIs, or screenshots, keep both languages in sync.

About

LiteQueue is a local-first queue management system for solo developers and small teams. It runs on SQLite, keeps setup lightweight, and combines ticketing with a flexible form engine that can calculate wait time and display contextual hints. LiteQueue 是一个面向个人开发者和小团队的本地优先排队系统。它基于 SQLite 运行,部署轻量,同时把工单管理与灵活表单引擎结合起来,可以自动计算等待时间并展示上下文提示。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors