create-jinmankn-app 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/bin/index.js +76 -0
  2. package/package.json +20 -0
  3. package/templates/blueprint/BLUEPRINT_REPRODUCTION_PROMPT.md +996 -0
  4. package/templates/blueprint/HOW_IT_WORKS.md +286 -0
  5. package/templates/blueprint/README.md +123 -0
  6. package/templates/blueprint/backend/config/db.js +12 -0
  7. package/templates/blueprint/backend/controllers/authController.js +90 -0
  8. package/templates/blueprint/backend/controllers/itemController.js +74 -0
  9. package/templates/blueprint/backend/middleware/auth.js +32 -0
  10. package/templates/blueprint/backend/middleware/errorHandler.js +23 -0
  11. package/templates/blueprint/backend/models/Item.js +26 -0
  12. package/templates/blueprint/backend/models/User.js +28 -0
  13. package/templates/blueprint/backend/package-lock.json +2190 -0
  14. package/templates/blueprint/backend/package.json +23 -0
  15. package/templates/blueprint/backend/routes/authRoutes.js +11 -0
  16. package/templates/blueprint/backend/routes/healthRoutes.js +9 -0
  17. package/templates/blueprint/backend/routes/itemRoutes.js +21 -0
  18. package/templates/blueprint/backend/server.js +29 -0
  19. package/templates/blueprint/frontend/.env.example +1 -0
  20. package/templates/blueprint/frontend/index.html +13 -0
  21. package/templates/blueprint/frontend/package-lock.json +2844 -0
  22. package/templates/blueprint/frontend/package.json +23 -0
  23. package/templates/blueprint/frontend/public/favicon.svg +4 -0
  24. package/templates/blueprint/frontend/src/App.jsx +78 -0
  25. package/templates/blueprint/frontend/src/assets/logo.svg +4 -0
  26. package/templates/blueprint/frontend/src/components/DashboardLayout.jsx +103 -0
  27. package/templates/blueprint/frontend/src/components/ProtectedRoute.jsx +18 -0
  28. package/templates/blueprint/frontend/src/index.css +1 -0
  29. package/templates/blueprint/frontend/src/main.jsx +13 -0
  30. package/templates/blueprint/frontend/src/pages/DashboardHome.jsx +74 -0
  31. package/templates/blueprint/frontend/src/pages/Items.jsx +243 -0
  32. package/templates/blueprint/frontend/src/pages/Login.jsx +101 -0
  33. package/templates/blueprint/frontend/src/pages/Profile.jsx +79 -0
  34. package/templates/blueprint/frontend/src/pages/Register.jsx +122 -0
  35. package/templates/blueprint/frontend/src/pages/Report.jsx +124 -0
  36. package/templates/blueprint/frontend/vite.config.js +10 -0
  37. package/templates/blueprint/package.json +13 -0
  38. package/templates/blueprint/scripts/pack-blueprint.ps1 +18 -0
  39. package/templates/chom/Backend/app.js +25 -0
  40. package/templates/chom/Backend/package-lock.json +1551 -0
  41. package/templates/chom/Backend/package.json +23 -0
  42. package/templates/chom/Backend/seedAdmin.js +21 -0
  43. package/templates/chom/Backend/src/controllers/payment.c.js +57 -0
  44. package/templates/chom/Backend/src/controllers/students.c.js +58 -0
  45. package/templates/chom/Backend/src/controllers/users.c.js +62 -0
  46. package/templates/chom/Backend/src/middleware/authentication.js +18 -0
  47. package/templates/chom/Backend/src/models/payment.m.js +13 -0
  48. package/templates/chom/Backend/src/models/students.m.js +10 -0
  49. package/templates/chom/Backend/src/models/users.m.js +11 -0
  50. package/templates/chom/Backend/src/routes/users.r.js +21 -0
  51. package/templates/chom/Frontend/README.md +16 -0
  52. package/templates/chom/Frontend/eslint.config.js +21 -0
  53. package/templates/chom/Frontend/index.html +13 -0
  54. package/templates/chom/Frontend/package-lock.json +3075 -0
  55. package/templates/chom/Frontend/package.json +31 -0
  56. package/templates/chom/Frontend/public/favicon.svg +1 -0
  57. package/templates/chom/Frontend/public/icons.svg +24 -0
  58. package/templates/chom/Frontend/src/App.css +189 -0
  59. package/templates/chom/Frontend/src/App.jsx +28 -0
  60. package/templates/chom/Frontend/src/api/api.jsx +27 -0
  61. package/templates/chom/Frontend/src/assets/hero.png +0 -0
  62. package/templates/chom/Frontend/src/assets/react.svg +1 -0
  63. package/templates/chom/Frontend/src/assets/vite.svg +1 -0
  64. package/templates/chom/Frontend/src/components/Navbar.jsx +21 -0
  65. package/templates/chom/Frontend/src/index.css +8 -0
  66. package/templates/chom/Frontend/src/main.jsx +10 -0
  67. package/templates/chom/Frontend/src/pages/Dashboard.jsx +21 -0
  68. package/templates/chom/Frontend/src/pages/Landing.jsx +39 -0
  69. package/templates/chom/Frontend/src/pages/Login.jsx +49 -0
  70. package/templates/chom/Frontend/src/pages/Overview.jsx +42 -0
  71. package/templates/chom/Frontend/src/pages/Register.jsx +76 -0
  72. package/templates/chom/Frontend/src/pages/Students.jsx +14 -0
  73. package/templates/chom/Frontend/vite.config.js +8 -0
  74. package/templates/chom/package.json +13 -0
  75. package/templates/hospital-faisal/backend/.env.example +9 -0
  76. package/templates/hospital-faisal/backend/config/db.js +96 -0
  77. package/templates/hospital-faisal/backend/controllers/appointmentController.js +164 -0
  78. package/templates/hospital-faisal/backend/controllers/authController.js +106 -0
  79. package/templates/hospital-faisal/backend/controllers/hospitalReportController.js +72 -0
  80. package/templates/hospital-faisal/backend/controllers/medicalReportController.js +105 -0
  81. package/templates/hospital-faisal/backend/controllers/patientController.js +98 -0
  82. package/templates/hospital-faisal/backend/database/schema.sql +47 -0
  83. package/templates/hospital-faisal/backend/middleware/auth.js +30 -0
  84. package/templates/hospital-faisal/backend/middleware/errorHandler.js +23 -0
  85. package/templates/hospital-faisal/backend/middleware/role.js +6 -0
  86. package/templates/hospital-faisal/backend/package-lock.json +2092 -0
  87. package/templates/hospital-faisal/backend/package.json +23 -0
  88. package/templates/hospital-faisal/backend/routes/appointmentRoutes.js +25 -0
  89. package/templates/hospital-faisal/backend/routes/authRoutes.js +12 -0
  90. package/templates/hospital-faisal/backend/routes/healthRoutes.js +9 -0
  91. package/templates/hospital-faisal/backend/routes/hospitalReportRoutes.js +10 -0
  92. package/templates/hospital-faisal/backend/routes/medicalReportRoutes.js +16 -0
  93. package/templates/hospital-faisal/backend/routes/patientRoutes.js +22 -0
  94. package/templates/hospital-faisal/backend/server.js +46 -0
  95. package/templates/hospital-faisal/frontend/.env.example +1 -0
  96. package/templates/hospital-faisal/frontend/index.html +10 -0
  97. package/templates/hospital-faisal/frontend/package-lock.json +2844 -0
  98. package/templates/hospital-faisal/frontend/package.json +23 -0
  99. package/templates/hospital-faisal/frontend/public/favicon.svg +4 -0
  100. package/templates/hospital-faisal/frontend/src/App.jsx +56 -0
  101. package/templates/hospital-faisal/frontend/src/api.js +20 -0
  102. package/templates/hospital-faisal/frontend/src/assets/logo.svg +4 -0
  103. package/templates/hospital-faisal/frontend/src/components/DashboardLayout.jsx +114 -0
  104. package/templates/hospital-faisal/frontend/src/components/ProtectedRoute.jsx +18 -0
  105. package/templates/hospital-faisal/frontend/src/components/RoleRoute.jsx +14 -0
  106. package/templates/hospital-faisal/frontend/src/index.css +1 -0
  107. package/templates/hospital-faisal/frontend/src/main.jsx +13 -0
  108. package/templates/hospital-faisal/frontend/src/pages/Appointments.jsx +305 -0
  109. package/templates/hospital-faisal/frontend/src/pages/DashboardHome.jsx +105 -0
  110. package/templates/hospital-faisal/frontend/src/pages/Login.jsx +98 -0
  111. package/templates/hospital-faisal/frontend/src/pages/MedicalReports.jsx +182 -0
  112. package/templates/hospital-faisal/frontend/src/pages/Patients.jsx +237 -0
  113. package/templates/hospital-faisal/frontend/src/pages/Profile.jsx +78 -0
  114. package/templates/hospital-faisal/frontend/src/pages/Register.jsx +133 -0
  115. package/templates/hospital-faisal/frontend/src/pages/Report.jsx +167 -0
  116. package/templates/hospital-faisal/frontend/vite.config.js +10 -0
  117. package/templates/hospital-faisal/package.json +13 -0
@@ -0,0 +1,23 @@
1
+ {
2
+ "dependencies": {
3
+ "bcrypt": "^6.0.0",
4
+ "cors": "^2.8.6",
5
+ "dotenv": "^17.4.2",
6
+ "express": "^5.2.1",
7
+ "jsonwebtoken": "^9.0.3",
8
+ "mongoose": "^9.5.0",
9
+ "nodemon": "^3.1.14"
10
+ },
11
+ "name": "backend",
12
+ "version": "1.0.0",
13
+ "description": "",
14
+ "main": "app.js",
15
+ "scripts": {
16
+ "test": "echo \"Error: no test specified\" && exit 1",
17
+ "dev": "nodemon app.js"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "type": "commonjs"
23
+ }
@@ -0,0 +1,21 @@
1
+ const mongoose = require("mongoose")
2
+ const bcrypt = require("bcrypt")
3
+ const dotenv = require("dotenv")
4
+ dotenv.config()
5
+
6
+ const MONGO = process.env.MONGO_UI
7
+
8
+ mongoose.connect(MONGO, {
9
+ useNewUrlParser: true,
10
+ useNewTopology: true
11
+ })
12
+ .then(() => console.log("Nicely done"))
13
+ .catch(error => console.log("Failed", console.error(error)))
14
+
15
+ exports.createAdmin = async (req, res) => {
16
+ const names = "Guerschom"
17
+ const password = 12345
18
+
19
+ const hashedPassword = await bcrypt.hash(password, 10)
20
+
21
+ }
@@ -0,0 +1,57 @@
1
+ const Payment = require("../models/payment.m")
2
+
3
+ exports.getPayment = async (req, res) => {
4
+ try {
5
+ const all_payment = await Payment.find()
6
+
7
+ return res.status(200).json({ message: "All Payment gathered well", Payment: all_Payment })
8
+ } catch (error) {
9
+ return res.status(500).json({ message: "Internal Server Error", error: error.message })
10
+ }
11
+ }
12
+
13
+ exports.createPayment = async (req, res) => {
14
+ try {
15
+ const { student_id, amount } = req.body
16
+ if (!student_id || !amount) return res.status(401).json({ message: "All fields are requried bro" })
17
+
18
+ const newPayment = new Payment({
19
+ student_id,
20
+ amount
21
+ })
22
+
23
+ await newPayment.save()
24
+
25
+ return res.status(201).json({ message: "Payment added to database Successfully", data: newPayment })
26
+
27
+ } catch (error) {
28
+ return res.status(500).json({ message: "Internal Server Error", error: error.message })
29
+ }
30
+ }
31
+
32
+ exports.updatePayment = async (req, res) => {
33
+ try {
34
+ const { id } = req.params
35
+ const { student_id, amount } = req.body
36
+ const paymenyExists = await Payment.findById(id)
37
+ if (!paymenyExists) return res.status(404).json({ message: "Payment not Found" })
38
+
39
+ const updates = await Payment.findByIdAndUpdate(id, req.body, { new: true })
40
+ return res.status(200).json({ message: "Payment Updated successfully", data: updates })
41
+ } catch (error) {
42
+ return res.status(500).json({ message: "Internal Server Error", error: error.message })
43
+ }
44
+ }
45
+
46
+ exports.deletePayment = async (req, res) => {
47
+ try {
48
+ const { id } = req.params
49
+ const paymenyExists = await Payment.findById(id)
50
+ if(!paymenyExists) return res.status(404).json({message: "Payment Not Found"})
51
+
52
+ const deletes = await Payment.findByIdAndDelete(id)
53
+ return res.status(200).json({message: "Payment Deleted Succefully"})
54
+ } catch (error) {
55
+ return res.status(500).json({ message: "Internal Server Error", error: error.message })
56
+ }
57
+ }
@@ -0,0 +1,58 @@
1
+ const Students = require("../models/students.m")
2
+
3
+ exports.getStudent = async (req, res) => {
4
+ try {
5
+ const all_students = await Students.find()
6
+
7
+ return res.status(200).json({ message: "All students gathered well", students: all_students })
8
+ } catch (error) {
9
+ return res.status(500).json({ message: "Internal Server Error", error: error.message })
10
+ }
11
+ }
12
+
13
+ exports.createStudent = async (req, res) => {
14
+ try {
15
+ const { full_names, classes, parent_phone } = req.body
16
+ if (!full_names || !classes || !parent_phone) return res.status(400).json({ message: "All fields are requried bro" })
17
+
18
+ const newStudent = new Students({
19
+ full_names,
20
+ classes,
21
+ parent_phone
22
+ })
23
+
24
+ await newStudent.save()
25
+
26
+ return res.status(201).json({ message: "Student added to database Successfully", data: newStudent })
27
+
28
+ } catch (error) {
29
+ return res.status(500).json({ message: "Internal Server Error", error: error.message })
30
+ }
31
+ }
32
+
33
+ exports.updateStudent = async (req, res) => {
34
+ try {
35
+ const { id } = req.params
36
+ const { full_names, classes, parent_phone } = req.body
37
+ const studentExists = await Students.findById(id)
38
+ if (!studentExists) return res.status(404).json({ message: "Student not Found" })
39
+
40
+ const updates = await Students.findByIdAndUpdate(id, req.body, { new: true })
41
+ return res.status(200).json({ message: "Student Updated successfully", data: updates })
42
+ } catch (error) {
43
+ return res.status(500).json({ message: "Internal Server Error", error: error.message })
44
+ }
45
+ }
46
+
47
+ exports.deleteStudent = async (req, res) => {
48
+ try {
49
+ const { id } = req.params
50
+ const studentExists = await Students.findById(id)
51
+ if(!studentExists) return res.status(404).json({message: "Student Not Found"})
52
+
53
+ const deletes = await Students.findByIdAndDelete(id)
54
+ return res.status(200).json({message: "Student Deleted Succefully"})
55
+ } catch (error) {
56
+ return res.status(500).json({ message: "Internal Server Error", error: error.message })
57
+ }
58
+ }
@@ -0,0 +1,62 @@
1
+ const bcrypt = require("bcrypt")
2
+ const User = require("../models/users.m")
3
+ const jwt = require("jsonwebtoken")
4
+
5
+ exports.registerUser = async (req, res) => {
6
+ try {
7
+ const { names, email, password, role } = req.body;
8
+ if (!names || !email || !password) return res.status(400).json({ message: "All fields are required" })
9
+ const existsUser = await User.findOne({ email })
10
+
11
+ if (existsUser) return res.status(403).json("User alreay exists")
12
+
13
+ const hashedPassword = await bcrypt.hash(password, 10)
14
+
15
+ const newUser = new User({
16
+ names,
17
+ email,
18
+ password: hashedPassword,
19
+ role
20
+ })
21
+
22
+ await newUser.save()
23
+
24
+ res.status(201).json({
25
+ message: "User created Successfully",
26
+ user: newUser
27
+ })
28
+
29
+ } catch (error) {
30
+ return res.status(500).json({ message: "Internal Server Error", error: error.message })
31
+ }
32
+ }
33
+
34
+ exports.loginUser = async (req, res) => {
35
+ try {
36
+ const { email, password } = req.body;
37
+ if (!email || !password) return res.status(400).json({ message: "All fields are required" })
38
+
39
+ const userExists = await User.findOne({ email })
40
+ if (!userExists) return res.status(404).json({ message: "USER NOT FOUND, Register first" })
41
+
42
+ const isMatch = await bcrypt.compare(password, userExists.password)
43
+ if (!isMatch) return res.status(403).json({ message: "Enter the true password" })
44
+
45
+ const token = jwt.sign(
46
+ { id: userExists._id, role: userExists.role },
47
+ process.env.JWT_SECRET,
48
+ { expiresIn: "30d" }
49
+ )
50
+
51
+ res.status(200).json({
52
+ message: "Logged In Well",
53
+ data: {
54
+ userExists,
55
+ token: token
56
+ }
57
+ })
58
+ } catch (error) {
59
+ return res.status(500).json({
60
+ message: "Internal Server Error", error: error.message})
61
+ }
62
+ }
@@ -0,0 +1,18 @@
1
+ const jwt = require("jsonwebtoken")
2
+
3
+ exports.Auth = async (req, res, next) => {
4
+ try{
5
+ const authHeader = req.headers.authorization
6
+ if(!authHeader) return res.status(403).json({ message: "Access Denied"})
7
+
8
+ const token = authHeader.split(" ")[1]
9
+ if(!token) return res.status(401).json({message: "No tokn found"})
10
+
11
+ const decode = jwt.verify(token, process.env.JWT_SECRET)
12
+ req.user = decode
13
+
14
+ next()
15
+ } catch(error) {
16
+ return res.status(500).json({message: "Internal Server Error", error: error.message})
17
+ }
18
+ }
@@ -0,0 +1,13 @@
1
+ const mongoose = require("mongoose")
2
+
3
+ const Payment_schema = new mongoose.Schema({
4
+ student_id: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: "Student"
7
+ },
8
+ amount: { type: String, required: true },
9
+ payment_date: { type: Date, default: Date.now },
10
+ created_At: { type: Date, default: Date.now },
11
+ })
12
+
13
+ module.exports = mongoose.model("Payment", Payment_schema)
@@ -0,0 +1,10 @@
1
+ const mongoose = require("mongoose")
2
+
3
+ const Student_schema = new mongoose.Schema({
4
+ full_names: { type: String, required: true },
5
+ classes: { type: String, required: true },
6
+ parent_phone: { type: String, required: true },
7
+ created_At: { type: Date, default: Date.now },
8
+ })
9
+
10
+ module.exports = mongoose.model("Student", Student_schema)
@@ -0,0 +1,11 @@
1
+ const mongoose = require("mongoose")
2
+
3
+ const User_schema = new mongoose.Schema({
4
+ names: { type: String, required: true },
5
+ email: { type: String, required: true },
6
+ password: { type: String, required: true },
7
+ role: { type: String, default: "user" },
8
+ created_At: { type: Date, default: Date.now },
9
+ })
10
+
11
+ module.exports = mongoose.model("User", User_schema)
@@ -0,0 +1,21 @@
1
+ const express = require("express")
2
+ const router = express.Router()
3
+ const {registerUser, loginUser} = require("../controllers/users.c")
4
+ const { Auth } = require("../middleware/authentication")
5
+ const { createStudent, updateStudent, getStudent, deleteStudent } = require("../controllers/students.c")
6
+ const { createPayment, updatePayment, deletePayment, getPayment } = require("../controllers/payment.c")
7
+
8
+ router.post("/register", registerUser)
9
+ router.post("/login", loginUser)
10
+
11
+ router.get("/students",Auth, getStudent)
12
+ router.post("/students",Auth, createStudent)
13
+ router.put("/students/:id",Auth, updateStudent)
14
+ router.delete("/students/:id",Auth, deleteStudent)
15
+
16
+ router.get("/payment",Auth, getPayment)
17
+ router.post("/payment",Auth, createPayment)
18
+ router.put("/payment/:id",Auth, updatePayment)
19
+ router.delete("/payment/:id",Auth, deletePayment)
20
+
21
+ module.exports = router
@@ -0,0 +1,16 @@
1
+ # React + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
@@ -0,0 +1,21 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import { defineConfig, globalIgnores } from 'eslint/config'
6
+
7
+ export default defineConfig([
8
+ globalIgnores(['dist']),
9
+ {
10
+ files: ['**/*.{js,jsx}'],
11
+ extends: [
12
+ js.configs.recommended,
13
+ reactHooks.configs.flat.recommended,
14
+ reactRefresh.configs.vite,
15
+ ],
16
+ languageOptions: {
17
+ globals: globals.browser,
18
+ parserOptions: { ecmaFeatures: { jsx: true } },
19
+ },
20
+ },
21
+ ])
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>frontend</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.jsx"></script>
12
+ </body>
13
+ </html>