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,79 @@
1
+ import { useEffect, useState } from 'react';
2
+ import axios from 'axios';
3
+
4
+ function Profile() {
5
+ const [user, setUser] = useState(null);
6
+ const [error, setError] = useState('');
7
+ const [loading, setLoading] = useState(true);
8
+
9
+ const handleRetrieve = async () => {
10
+ try {
11
+ const response = await axios.get('http://localhost:5000/api/auth/me', {
12
+ headers: {
13
+ Authorization: `Bearer ${localStorage.getItem('token')}`,
14
+ },
15
+ });
16
+ setUser(response.data.user);
17
+ localStorage.setItem('user', JSON.stringify(response.data.user));
18
+ } catch (err) {
19
+ const storedUser = localStorage.getItem('user');
20
+ if (storedUser) {
21
+ setUser(JSON.parse(storedUser));
22
+ } else {
23
+ setError(err.response?.data?.message || 'Failed to load profile');
24
+ }
25
+ console.error('Server Error:', err.response?.data || err.message);
26
+ } finally {
27
+ setLoading(false);
28
+ }
29
+ };
30
+
31
+ useEffect(() => {
32
+ handleRetrieve();
33
+ }, []);
34
+
35
+ if (loading) {
36
+ return <p className="text-slate-500">Loading profile...</p>;
37
+ }
38
+
39
+ if (!user) {
40
+ return (
41
+ <p className="text-slate-600">
42
+ {error || 'No profile data found. Try signing in again.'}
43
+ </p>
44
+ );
45
+ }
46
+
47
+ return (
48
+ <div className="max-w-lg">
49
+ <h1 className="text-2xl font-bold text-slate-800 mb-6">Profile</h1>
50
+
51
+ {error && (
52
+ <p className="mb-4 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2">
53
+ {error}
54
+ </p>
55
+ )}
56
+
57
+ <div className="bg-white rounded-lg shadow-sm border border-slate-200 divide-y divide-slate-200">
58
+ <div className="px-6 py-4 flex justify-between gap-4">
59
+ <span className="text-sm font-medium text-slate-500">Name</span>
60
+ <span className="text-sm text-slate-800">{user.name}</span>
61
+ </div>
62
+ <div className="px-6 py-4 flex justify-between gap-4">
63
+ <span className="text-sm font-medium text-slate-500">Email</span>
64
+ <span className="text-sm text-slate-800">{user.email}</span>
65
+ </div>
66
+ {user.id && (
67
+ <div className="px-6 py-4 flex justify-between gap-4">
68
+ <span className="text-sm font-medium text-slate-500">User ID</span>
69
+ <span className="text-sm text-slate-800 font-mono truncate max-w-[200px]">
70
+ {user.id}
71
+ </span>
72
+ </div>
73
+ )}
74
+ </div>
75
+ </div>
76
+ );
77
+ }
78
+
79
+ export default Profile;
@@ -0,0 +1,122 @@
1
+ import { useState } from 'react';
2
+ import axios from 'axios';
3
+ import { Link, useNavigate } from 'react-router-dom';
4
+
5
+ function Register() {
6
+ const navigate = useNavigate();
7
+ const [name, setName] = useState('');
8
+ const [email, setEmail] = useState('');
9
+ const [password, setPassword] = useState('');
10
+ const [error, setError] = useState('');
11
+ const [message, setMessage] = useState('');
12
+ const [loading, setLoading] = useState(false);
13
+
14
+ const handleSubmit = async (e) => {
15
+ e.preventDefault();
16
+ setError('');
17
+ setMessage('');
18
+ setLoading(true);
19
+
20
+ try {
21
+ const response = await axios.post('http://localhost:5000/api/auth/register', {
22
+ name,
23
+ email,
24
+ password,
25
+ });
26
+ localStorage.setItem('token', response.data.token);
27
+ localStorage.setItem('user', JSON.stringify(response.data.user));
28
+ setMessage('Account created successfully');
29
+ navigate('/dashboard');
30
+ } catch (err) {
31
+ setError(err.response?.data?.message || 'Registration failed');
32
+ console.error('Server Error:', err.response?.data || err.message);
33
+ } finally {
34
+ setLoading(false);
35
+ }
36
+ };
37
+
38
+ return (
39
+ <div className="min-h-screen flex items-center justify-center px-4">
40
+ <div className="w-full max-w-md bg-white rounded-lg shadow-md p-8">
41
+ <h1 className="text-2xl font-bold text-slate-800 mb-6">Create account</h1>
42
+
43
+ {message && (
44
+ <p className="mb-4 text-sm text-green-700 bg-green-50 border border-green-200 rounded px-3 py-2">
45
+ {message}
46
+ </p>
47
+ )}
48
+
49
+ {error && (
50
+ <p className="mb-4 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2">
51
+ {error}
52
+ </p>
53
+ )}
54
+
55
+ <form onSubmit={handleSubmit} className="space-y-4">
56
+ <div>
57
+ <label htmlFor="name" className="block text-sm font-medium text-slate-700 mb-1">
58
+ Name
59
+ </label>
60
+ <input
61
+ id="name"
62
+ name="name"
63
+ type="text"
64
+ required
65
+ value={name}
66
+ onChange={(e) => setName(e.target.value)}
67
+ className="w-full border border-slate-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
68
+ />
69
+ </div>
70
+
71
+ <div>
72
+ <label htmlFor="email" className="block text-sm font-medium text-slate-700 mb-1">
73
+ Email
74
+ </label>
75
+ <input
76
+ id="email"
77
+ name="email"
78
+ type="email"
79
+ required
80
+ value={email}
81
+ onChange={(e) => setEmail(e.target.value)}
82
+ className="w-full border border-slate-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
83
+ />
84
+ </div>
85
+
86
+ <div>
87
+ <label htmlFor="password" className="block text-sm font-medium text-slate-700 mb-1">
88
+ Password
89
+ </label>
90
+ <input
91
+ id="password"
92
+ name="password"
93
+ type="password"
94
+ required
95
+ minLength={6}
96
+ value={password}
97
+ onChange={(e) => setPassword(e.target.value)}
98
+ className="w-full border border-slate-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
99
+ />
100
+ </div>
101
+
102
+ <button
103
+ type="submit"
104
+ disabled={loading}
105
+ className="w-full bg-blue-600 text-white font-medium py-2 rounded hover:bg-blue-700 disabled:opacity-50"
106
+ >
107
+ {loading ? 'Creating account...' : 'Register'}
108
+ </button>
109
+ </form>
110
+
111
+ <p className="mt-4 text-sm text-slate-600 text-center">
112
+ Already have an account?{' '}
113
+ <Link to="/login" className="text-blue-600 hover:underline">
114
+ Sign in
115
+ </Link>
116
+ </p>
117
+ </div>
118
+ </div>
119
+ );
120
+ }
121
+
122
+ export default Register;
@@ -0,0 +1,124 @@
1
+ import { useEffect, useState } from 'react';
2
+ import axios from 'axios';
3
+
4
+ function Report() {
5
+ const [user, setUser] = useState(null);
6
+ const [items, setItems] = useState([]);
7
+ const [error, setError] = useState('');
8
+ const [loading, setLoading] = useState(true);
9
+ const [generatedAt] = useState(() => new Date().toLocaleString());
10
+
11
+ const getAuthHeaders = () => ({
12
+ Authorization: `Bearer ${localStorage.getItem('token')}`,
13
+ });
14
+
15
+ const handleRetrieve = async () => {
16
+ try {
17
+ const [userRes, itemsRes] = await Promise.all([
18
+ axios.get('http://localhost:5000/api/auth/me', { headers: getAuthHeaders() }),
19
+ axios.get('http://localhost:5000/api/items', { headers: getAuthHeaders() }),
20
+ ]);
21
+ setUser(userRes.data.user);
22
+ setItems(itemsRes.data.items);
23
+ } catch (err) {
24
+ setError(err.response?.data?.message || 'Failed to load report data');
25
+ console.error('Server Error:', err.response?.data || err.message);
26
+ } finally {
27
+ setLoading(false);
28
+ }
29
+ };
30
+
31
+ useEffect(() => {
32
+ handleRetrieve();
33
+ }, []);
34
+
35
+ const handlePrint = () => {
36
+ window.print();
37
+ };
38
+
39
+ if (loading) {
40
+ return <p className="text-slate-500">Loading report...</p>;
41
+ }
42
+
43
+ return (
44
+ <div className="max-w-4xl">
45
+ <div className="flex flex-wrap items-start justify-between gap-4 mb-6 print:hidden">
46
+ <div>
47
+ <h1 className="text-2xl font-bold text-slate-800">Report</h1>
48
+ <p className="text-slate-600 mt-1">
49
+ Summary you can reuse in every project. Print or save as PDF from the browser.
50
+ </p>
51
+ </div>
52
+
53
+ </div>
54
+
55
+ {error && (
56
+ <p className="mb-4 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2 print:hidden">
57
+ {error}
58
+ </p>
59
+ )}
60
+
61
+ <article className="bg-white rounded-lg shadow-sm border border-slate-200 p-6 print:shadow-none print:border-0">
62
+ <header className="border-b border-slate-200 pb-4 mb-6">
63
+ <p className="text-xs font-semibold uppercase tracking-wider text-slate-500">
64
+ Project report
65
+ </p>
66
+ <h2 className="text-xl font-bold text-slate-800 mt-1">Blueprint summary</h2>
67
+ <p className="text-sm text-slate-500 mt-2">Generated: {generatedAt}</p>
68
+ </header>
69
+
70
+ <section className="mb-8">
71
+ <h3 className="text-sm font-semibold text-slate-700 uppercase tracking-wide mb-3">
72
+ Account
73
+ </h3>
74
+ {user ? (
75
+ <dl className="grid gap-2 sm:grid-cols-2 text-sm">
76
+ <div>
77
+ <dt className="text-slate-500">Name</dt>
78
+ <dd className="font-medium text-slate-800">{user.name}</dd>
79
+ </div>
80
+ <div>
81
+ <dt className="text-slate-500">Email</dt>
82
+ <dd className="font-medium text-slate-800">{user.email}</dd>
83
+ </div>
84
+ </dl>
85
+ ) : (
86
+ <p className="text-sm text-slate-500">No user data available.</p>
87
+ )}
88
+ </section>
89
+
90
+ <section>
91
+ <h3 className="text-sm font-semibold text-slate-700 uppercase tracking-wide mb-3">
92
+ Items ({items.length})
93
+ </h3>
94
+ {items.length === 0 ? (
95
+ <p className="text-sm text-slate-500">No items recorded.</p>
96
+ ) : (
97
+ <div className="overflow-x-auto">
98
+ <table className="w-full text-sm text-left border border-slate-200 rounded-lg overflow-hidden">
99
+ <thead className="bg-slate-50 text-slate-600">
100
+ <tr>
101
+ <th className="px-4 py-2 font-medium">Title</th>
102
+ <th className="px-4 py-2 font-medium">Description</th>
103
+ </tr>
104
+ </thead>
105
+ <tbody className="divide-y divide-slate-200">
106
+ {items.map((item) => (
107
+ <tr key={item._id}>
108
+ <td className="px-4 py-2 text-slate-800">{item.title}</td>
109
+ <td className="px-4 py-2 text-slate-600">
110
+ {item.description || '—'}
111
+ </td>
112
+ </tr>
113
+ ))}
114
+ </tbody>
115
+ </table>
116
+ </div>
117
+ )}
118
+ </section>
119
+ </article>
120
+ </div>
121
+ );
122
+ }
123
+
124
+ export default Report;
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import tailwindcss from '@tailwindcss/vite';
4
+
5
+ export default defineConfig({
6
+ plugins: [react(), tailwindcss()],
7
+ server: {
8
+ port: 5173,
9
+ },
10
+ });
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "blueprint",
3
+ "version": "1.0.0",
4
+ "description": "A reusable full-stack starter template with authentication, CRUD, and MongoDB. Copy or rename this folder to bootstrap any new project.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "type": "commonjs"
13
+ }
@@ -0,0 +1,18 @@
1
+ # Creates blueprint-source.zip (no node_modules/dist) for exact reproduction or sharing.
2
+ $root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
3
+ if (Test-Path "$PSScriptRoot\..\backend\package.json") {
4
+ $root = Resolve-Path "$PSScriptRoot\.."
5
+ }
6
+
7
+ $out = Join-Path $root "blueprint-source.zip"
8
+ $temp = Join-Path $env:TEMP "blueprint-pack-$(Get-Random)"
9
+
10
+ New-Item -ItemType Directory -Path $temp | Out-Null
11
+ robocopy $root $temp /E /XD node_modules dist .git /XF *.zip package-lock.json | Out-Null
12
+
13
+ if (Test-Path $out) { Remove-Item $out -Force }
14
+ Compress-Archive -Path "$temp\*" -DestinationPath $out -Force
15
+ Remove-Item $temp -Recurse -Force
16
+
17
+ Write-Host "Created: $out"
18
+ Write-Host "Give another AI: unzip and run npm install in backend + frontend, copy .env.example files to .env"
@@ -0,0 +1,25 @@
1
+ const express = require("express")
2
+ const app = express()
3
+ const cors = require("cors")
4
+ const mongoose = require("mongoose")
5
+ const dotenv = require("dotenv")
6
+ dotenv.config()
7
+
8
+ const PORT = process.env.PORT
9
+ const MONGO = process.env.MONGO_UI
10
+
11
+ const UserRoutes = require("./src/routes/users.r")
12
+
13
+ app.use(cors())
14
+ app.use(express.json())
15
+ app.use("/api", UserRoutes)
16
+
17
+ mongoose.connect(MONGO)
18
+ .then(() => console.log("Database Connected"))
19
+ .catch((err) => console.log("Error to connect database", err))
20
+
21
+ app.get("/", async (req, res) => {
22
+ res.send("Hii, I'm working here.!!!!")
23
+ })
24
+
25
+ app.listen(PORT, console.log(`Server is running at http://localhost:${PORT}`))