Skip to content

ZhouYinLong-lab/NanE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

181 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NanE ๅ—ๆ˜“

Node.js PostgreSQL JavaScript PWA Tests

NanE๏ผˆๅ—ๆ˜“๏ผ‰ๆ˜ฏ้ขๅ‘ๅ—ไบฌๅคงๅญฆๆ กๅ›ญๅœบๆ™ฏ็š„ๅ…่ดนไบ’ๅŠฉๅนณๅฐใ€‚ๅฎƒๅธฎๅŠฉๅŒๅญฆๆŠŠๅฎฟ่ˆ้‡Œไธดๆ—ถ้—ฒ็ฝฎใ€ไปๅฏๅฎ‰ๅ…จไฝฟ็”จ็š„ๅบ”ๆ€ฅ่€—ๆใ€้žๅค„ๆ–นๅธธ่ง่ฏๅ“็ฌผ็ปŸๅˆ†็ฑป็‰ฉๅ“ๅ’Œๅธธ็”จๅทฅๅ…ท๏ผŒๅˆ†ไบซ็ป™้™„่ฟ‘็œŸๆญฃ้œ€่ฆ็š„ไบบใ€‚

ๅนณๅฐ็š„ๆ ธๅฟƒไธๆ˜ฏไบŒๆ‰‹ไบคๆ˜“๏ผŒ่€Œๆ˜ฏๅŒๆฅผๆ ‹ใ€ๅŒๅฎฟ่ˆ็พคใ€ๅŒๆ กๅŒบไผ˜ๅ…ˆ็š„ๆ กๅ›ญไบ’ๅŠฉๆ’ฎๅˆใ€‚NanE ไธๅšไนฐๅ–ใ€ไธๅš้…้€ใ€ไธๆไพ›ๅŒป็–—ๅปบ่ฎฎ๏ผ›ๅฎƒๅช่ดŸ่ดฃๆŠŠๅฏไฟกใ€ๅฎกๆ ธ่ฟ‡็š„ไฟกๆฏๅฑ•็คบ็ป™ๅˆ้€‚่Œƒๅ›ดๅ†…็š„ๅŒๅญฆ๏ผŒๅนถๆŠŠไธ€ๆฌกไบ’ๅŠฉๆฒ‰ๆท€ไธบๅฏ่ฟฝ่ธช็š„ๅฑฅ็บฆ่ฎฐๅฝ•ใ€‚

Live Entrypoints

Surface URL
Web app https://nane.zylatent.com
Admin console https://nane.zylatent.com/admin
API health https://api.zylatent.com/api/health
API reference docs/api/index.md

Why It Exists

ๅฎฟ่ˆ็”Ÿๆดป้‡Œ็ปๅธธๅ‡บ็Žฐไธ€ไธชๅฐไฝ†็œŸๅฎž็š„็Ÿ›็›พ๏ผšๆœ‰ไบบๅช็”จไบ†ไธ€็‚นๅˆ›ๅฏ่ดดใ€็ข˜ไผๆฃ‰็ญพใ€้€€็ƒง่ดดใ€่ฟ‡ๆ•่ฏๆˆ–่žบไธๅˆ€๏ผŒๅ‰ฉไธ‹็š„ไธœ่ฅฟ้•ฟๆœŸ้—ฒ็ฝฎ๏ผ›ๅฆไธ€ไธชๅŒๅญฆๅดๅฏ่ƒฝๅœจๆทฑๅคœใ€้›จๅคฉใ€่€ƒ่ฏ•ๅ‘จๆˆ–็ชๅ‘ๅœบๆ™ฏ้‡Œไธดๆ—ถๆ€ฅ้œ€ใ€‚

็Žฐๆœ‰ๆธ ้“ๅ„ๆœ‰้—ฎ้ข˜๏ผš

  • ๅฎฟ่ˆ็พคๅ’Œๆœ‹ๅ‹ๅœˆๅ“ๅบ”ๅฟซ๏ผŒไฝ†ไฟกๆฏๅพˆๅฟซๆฒ‰ๅบ•๏ผŒๆ— ๆณ•ๆฒ‰ๆท€ไธบๅฏๆฃ€็ดข่ต„ๆบใ€‚
  • ไบŒๆ‰‹ๅนณๅฐๆ›ด้€‚ๅˆไบคๆ˜“๏ผŒไธ้€‚ๅˆไฝŽไปท็”š่‡ณๅ…่ดน็š„ๅบ”ๆ€ฅไบ’ๅŠฉ๏ผŒ่ฟ˜ไผšๅผ•ๅ…ฅไบคๆ˜“ๅ’Œ้™Œ็”Ÿไบบไฟกไปปๆˆๆœฌใ€‚
  • ๆ กๅ›ญ่ฎบๅ›ใ€่กจ็™ฝๅข™็ญ‰ๆธ ้“ไฟกๆฏ้ž็ป“ๆž„ๅŒ–๏ผŒๅพˆ้šพๆŒ‰ๆฅผๆ ‹ใ€ๆ กๅŒบใ€็ฑปๅž‹ๅ’Œๆœ‰ๆ•ˆๆœŸๅฟซ้€Ÿ็ญ›้€‰ใ€‚

NanE ็š„่งฃๅ†ณๆ–นๅผๆ˜ฏๆŠŠๆ กๅ›ญไบ’ๅŠฉๆ‹†ๆˆๅฏๅฎกๆ ธใ€ๅฏ็ญ›้€‰ใ€ๅฏ็กฎ่ฎคใ€ๅฏ่ฏ„ไปท็š„่ฝป้‡้—ญ็Žฏใ€‚

Product Boundaries

NanE ๆœ‰ไธ‰ๆก็กฌ่พน็•Œ๏ผš

  1. ๅชๅšๅ…่ดนไบ’ๅŠฉ๏ผš็ฆๆญขๆ”ถ่ดน่ฝฌ่ฎฉใ€ๅ˜็›ธไบคๆ˜“ๅ’Œๅ•†ไธšๅผ•ๆตใ€‚
  2. ๆ‰€ๆœ‰ๅ‘ๅธƒๅ…ˆๅฎกๆ ธ๏ผš็‰ฉๅ“้€š่ฟ‡ไบบๅทฅๅฎกๆ ธๅŽๆ‰ไผšๅ…ฌๅผ€ๅฑ•็คบใ€‚
  3. ่ฏๅ“ไธฅๆ ผๆ”ถๅฃ๏ผšๅชๅ…่ฎธๅธธ่ง้žๅค„ๆ–น่ฏ็š„็ฌผ็ปŸๅˆ†็ฑป๏ผŒไธๅฑ•็คบๅค„ๆ–น่ฏใ€็ฎกๅˆถ่ฏๅ“ๆˆ–ๅ…ทไฝ“็”จ่ฏๅปบ่ฎฎใ€‚

ๅนณๅฐไธไผšๆ›ฟ็”จๆˆทๅˆคๆ–ญ็‰ฉๅ“ๆ˜ฏๅฆ้€‚ๅˆไฝฟ็”จใ€‚้ข†ๅ–่€…ๅœจ่”็ณปๅ’Œ้ข†ๅ–ๅ‰๏ผŒ้œ€่ฆ่‡ช่กŒๆฃ€ๆŸฅๅŒ…่ฃ…ใ€ๆœ‰ๆ•ˆๆœŸใ€ไฟๅญ˜็Šถๆ€ๅ’Œ้€‚็”จ้ฃŽ้™ฉใ€‚

Current Features

Area Status What It Does
้ฆ–้กตๅ‘็Žฐ Done ๆœ็ดขใ€็ฑปๅž‹็ญ›้€‰ใ€ๅˆ†็ฑป็ญ›้€‰ใ€ๆŒ‰ๆฅผๆ ‹ๅˆ‡ๆขๆต่งˆ
่ฟ‘้‚ปๆŽ’ๅบ Done ๅŒๆฅผๆ ‹ > ๅŒๅฎฟ่ˆ็พค > ๅŒๆ กๅŒบ > ๅ…ถไป–ๆ กๅŒบ
ๆฅผๆ ‹ๅŠจๆ€ Done ๅฑ•็คบๆŒ‡ๅฎšๆฅผๆ ‹ๆœ€่ฟ‘ๅˆ†ไบซๅ’Œๅทฒ็กฎ่ฎค้ข†ๅ–
็‰ฉๅ“ๅ‘ๅธƒ Done ๆ”ฏๆŒ่€—ๆใ€่ฏๅ“ใ€ๅทฅๅ…ท๏ผŒๅซๅ›พ็‰‡ใ€ๆ•ฐ้‡ใ€ๆœ‰ๆ•ˆๆœŸใ€ไฝ็ฝฎๅ’Œ่”็ณปๆ–นๅผ
ไบบๅทฅๅฎกๆ ธ Done ็ฎก็†ๅ‘˜ๅฏ้€š่ฟ‡ใ€้ฉณๅ›žใ€ไธ‹ๆžถใ€ๆ‰น้‡ๅค„็†
่”็ณปๆ–นๅผไฟๆŠค Done ๆธธๅฎขไธๅฏ่ง่”็ณปๆ–นๅผ๏ผŒ็™ปๅฝ•ๅนถ่กฅๅ…จ่ต„ๆ–™ๅŽไธปๅŠจๆŸฅ็œ‹
้ข†ๅ–ๆ้†’ Done ้ข†ๅ–่€…ๆ้†’ๅ‘ๅธƒ่€…็กฎ่ฎค้ข†ๅ–
ๅฑฅ็บฆ่ฏ„ไปท Done ๅ‘ๅธƒ่€…ๅ’Œ้ข†ๅ–่€…ๅ„่ฏ„ไปทไธ€ๆฌก๏ผŒๅ…ฌๅผ€ๅฑ•็คบๆญฃๅ‘ๅฏไฟกๆ‘˜่ฆ
ๆˆ‘็š„้กต้ข Done ๆˆ‘็š„ๅ‘ๅธƒใ€้ข†ๅ–่ฎฐๅฝ•ใ€ๅพ…่ฏ„ไปท่ฎฐๅฝ•ใ€่ดฆๅท่ฎพ็ฝฎ
่ดฆๅท็ณป็ปŸ Done NJU ้‚ฎ็ฎฑ้ชŒ่ฏ็ ใ€ๅฏ†็ ็™ปๅฝ•ใ€้‡็ฝฎๅฏ†็ ใ€ๅ—ๅ“ช่ฎค่ฏไปฃ็†
ๅ›พ็‰‡ไธŠไผ  Done ๆ”ฏๆŒๆœฌๅœฐ/MinIO ๅญ˜ๅ‚จใ€็ฑปๅž‹ๆ ก้ชŒใ€ๅญคๅ„ฟๅ›พ็‰‡ๆธ…็†
็ฎก็†ๅŽๅฐ Done ๅฎกๆ ธใ€ไธพๆŠฅใ€็”จๆˆทใ€็ฎก็†ๅ‘˜ใ€ๆฅผๆ ‹ๅŠจๆ€ใ€็ปŸ่ฎก
PWA/้€š็Ÿฅ Partial Service Workerใ€manifestใ€Web Push ้…็ฝฎๅ…ฅๅฃ
ๅฐ็จ‹ๅบ็ซฏ Retained ๅพฎไฟกๅฐ็จ‹ๅบไปฃ็ ไฟ็•™๏ผŒๅฝ“ๅ‰ไธปไบคไป˜ไธบ Web

Core User Flow

ๆธธๅฎขๆต่งˆ
  -> NJU ้‚ฎ็ฎฑ็™ปๅฝ• / ๅ—ๅ“ช่ฎค่ฏ
  -> ่กฅๅ…จๆ˜ต็งฐใ€ๆ กๅŒบใ€ๆฅผๆ ‹
  -> ๅ‘ๅธƒ็‰ฉๅ“
  -> ็ฎก็†ๅ‘˜ๅฎกๆ ธ
  -> ้ฆ–้กตๅ…ฌๅผ€ๅฑ•็คบ
  -> ้ข†ๅ–่€…ๆŸฅ็œ‹่”็ณปๆ–นๅผ
  -> ็บฟไธ‹่”็ณปไธŽไบคๆŽฅ
  -> ้ข†ๅ–่€…ๆ้†’ๅทฒ้ข†ๅ–
  -> ๅ‘ๅธƒ่€…็กฎ่ฎค
  -> ๅŒๆ–นๅฑฅ็บฆ่ฏ„ไปท
  -> ๅฏไฟก่ฎฐๅฝ•ๆฒ‰ๆท€

Architecture

NanE ๆ˜ฏไธ€ไธชๅ•่ฟ›็จ‹ Node.js ๆœๅŠก๏ผŒ่ดŸ่ดฃ้™ๆ€ๆ–‡ไปถใ€ไธšๅŠก APIใ€็ฎก็†ๅŽๅฐๅ’Œๆ•ฐๆฎๅบ“ๅˆๅง‹ๅŒ–ใ€‚ๅ‰็ซฏๆฒกๆœ‰ๆž„ๅปบๆญฅ้ชค๏ผŒWeb ็ซฏไฝฟ็”จๅŽŸ็”Ÿ HTML/CSS/JavaScript๏ผ›ๅŽ็ซฏไฝฟ็”จ Node ๅ†…็ฝฎ http ๆจกๅ—ๅ’Œ PostgreSQLใ€‚

Browser / Mini Program
  -> Nginx HTTPS
  -> Node.js service :37878
      โ”œโ”€ /                 web app
      โ”œโ”€ /web/*            web static files
      โ”œโ”€ /admin            admin console
      โ”œโ”€ /admin/*          admin static files
      โ”œโ”€ /api/*            JSON API
      โ”œโ”€ /uploads/*        local uploaded images
      โ””โ”€ /assets/*         mini-program assets
  -> PostgreSQL

Backend Layout

server/
โ”œโ”€โ”€ index.js              # HTTP server, static serving, router dispatch
โ”œโ”€โ”€ db.js                 # PostgreSQL pool, schema init, migrations, seed data
โ”œโ”€โ”€ proximity.js          # campus/building proximity ranking
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ item-utils.js     # item shape, trust summary, icon normalization
โ”‚   โ”œโ”€โ”€ jwt.js            # signed JWT helpers
โ”‚   โ”œโ”€โ”€ logger.js         # structured logging
โ”‚   โ””โ”€โ”€ util.js           # JSON, body parsing, escaping, helpers
โ”œโ”€โ”€ middleware/
โ”‚   โ”œโ”€โ”€ auth.js           # verified user and admin guards
โ”‚   โ””โ”€โ”€ rate-limit.js     # lightweight login rate limiting
โ”œโ”€โ”€ router/
โ”‚   โ”œโ”€โ”€ auth.js           # /api/auth/*
โ”‚   โ”œโ”€โ”€ items.js          # /api/items/* and /api/activity
โ”‚   โ”œโ”€โ”€ claims.js         # /api/claims/*
โ”‚   โ”œโ”€โ”€ me.js             # /api/me/*
โ”‚   โ”œโ”€โ”€ admin.js          # /api/admin/* and /admin
โ”‚   โ”œโ”€โ”€ uploads.js        # /api/uploads/images
โ”‚   โ””โ”€โ”€ info.js           # health, locations, legal docs
โ””โ”€โ”€ service/
    โ”œโ”€โ”€ email.js          # SMTP verification and notifications
    โ”œโ”€โ”€ image-upload.js   # local/MinIO image storage
    โ”œโ”€โ”€ nanna.js          # ๅ—ๅ“ช API proxy
    โ””โ”€โ”€ push.js           # Web Push

Frontend Layout

web/
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ manifest.json
โ”œโ”€โ”€ sw.js
โ”œโ”€โ”€ css/
โ”‚   โ”œโ”€โ”€ tokens.css
โ”‚   โ”œโ”€โ”€ base.css
โ”‚   โ”œโ”€โ”€ layout.css
โ”‚   โ”œโ”€โ”€ components.css
โ”‚   โ””โ”€โ”€ fa-subset.css
โ””โ”€โ”€ js/
    โ”œโ”€โ”€ app.js            # app bootstrap and global state
    โ”œโ”€โ”€ api/client.js
    โ”œโ”€โ”€ ui/               # dialog, motion, skeleton, toast
    โ”œโ”€โ”€ utils/            # date, escape, validate
    โ””โ”€โ”€ views/            # home, publish, mine, settings

Tech Stack

Layer Technology
Web client Vanilla HTML/CSS/JavaScript
Admin console Vanilla HTML/CSS/JavaScript
Mini Program WeChat Mini Program code retained in miniprogram/
Backend Node.js native http
Database PostgreSQL via pg
Auth NJU email verification, password login, Nanna proxy, signed JWT
Mail SMTP
Images Local uploads or MinIO-compatible object storage
Push Web Push / VAPID
Deployment Azure VM, Ubuntu, Nginx, PM2, Let's Encrypt

Getting Started

Prerequisites

  • Node.js >= 18
  • PostgreSQL
  • npm

Install

npm install

Configure Environment

Copy the example file and fill in local values:

cp .env.example .env

Important variables:

PORT=37878
DATABASE_URL=postgres://postgres:postgres@localhost:5432/nane
JWT_SECRET=replace-with-a-long-random-secret
ADMIN_PASSWORD=replace-with-a-strong-admin-password
SMTP_HOST=smtp.qq.com
SMTP_PORT=465
SMTP_USER=your-qq-email@qq.com
SMTP_PASS=replace-with-smtp-authorization-code
PUBLIC_WEB_URL=https://nane.zylatent.com

Optional integrations include NANNA_API_KEY, MinIO settings and VAPID keys. Never commit real .env values.

Run Locally

npm start

Open:

http://localhost:37878
http://localhost:37878/admin
http://localhost:37878/api/health

On startup, the server initializes the database schema, applies compatibility migrations and inserts seed data when needed.

Testing

npm test

npm test starts an isolated test API server and runs the Node test suite. Current suite coverage includes:

  • public health, legal and locations endpoints
  • guest browsing
  • auth validation
  • protected route boundaries
  • item list/detail flows
  • admin stats/items/activity APIs
  • trust summary and fulfillment review helpers
  • proximity ranking
  • utility functions

Run tests against an already running server:

npm run test:direct

Use NANE_TEST_BASE_URL to point direct tests at another server.

Deployment

Production currently runs on an Azure VM behind Nginx and PM2.

cd ~/apps/NanE
git pull --ff-only
npm install
pm2 restart nane-api --update-env

Health check:

curl https://api.zylatent.com/api/health
pm2 status
pm2 logs nane-api --lines 80

Full notes are in docs/deployment-guide.md.

Demo Script

A short demo path for product review:

  1. Open the home page and show nearby items.
  2. Use search, category filters and "ๆขไธชๆฅผๆ ‹" to show cross-campus building browsing.
  3. Open an item detail and show that contact info is hidden for guests.
  4. Log in with a verified user and complete profile.
  5. Publish an item and show it enters review.
  6. Log into the admin console and approve it.
  7. Return to the home page, view contact info, and send a claim reminder.
  8. Confirm the claim from the publisher side.
  9. Submit fulfillment review tags.
  10. Show the trust summary and admin building activity panel.

More detailed scripts:

Documentation

Document Purpose
docs/api/index.md API reference
docs/deployment-guide.md production deployment and operations
docs/test-guide.md manual acceptance test guide
docs/ROADMAP.md staged engineering roadmap
docs/iteration-fulfillment-review.md fulfillment review MVP notes
docs/iteration-admin-convergence.md admin convergence notes
docs/user-agreement.md user agreement
docs/privacy-guideline-draft.md privacy guideline draft
CHANGELOG.md historical changes

Security and Privacy Notes

  • Public item lists never expose WeChat, QQ or room number.
  • Contact info is returned only through the dedicated contact endpoint.
  • Admin views include sensitive details and require admin JWT.
  • Location matching uses campus/building data instead of GPS.
  • Item posts require manual review before becoming public.
  • The project currently keeps CORS permissive for mini-program compatibility; tighten this before broader production rollout.
  • .env, SMTP credentials, JWT secrets, MinIO keys and Nanna keys must stay out of Git.

Project Status

NanE is a deployable competition MVP with several post-MVP refinements already included:

  • backend router/module split
  • responsive Web UI and dark mode
  • service worker cache
  • image upload and cleanup
  • fulfillment review and trust summary
  • admin reports, users, roles and building activity
  • API smoke/regression tests

Next likely directions:

  • migrate remaining compatibility DDL into explicit migration files
  • expand item/service taxonomy with stricter review rules
  • add admin audit search for reviews and abnormal users
  • improve CORS/security headers and request body limits
  • bring mini-program release flow back after deployment constraints are cleared

License

No open-source license is currently declared in this repository. Treat the code and project materials as private unless a license is added.

Acknowledgements

NanE is built around a simple campus idea: nearby students can help each other faster than a marketplace can. The project uses Node.js, PostgreSQL, Font Awesome Free, Web Push and the Nanjing University campus context to turn that idea into a working product loop.

About

๐Ÿ”— NanE โ€” a link-in-bio & personal landing platform for NJU students.

Topics

Resources

License

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors