project-startup 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 (38) hide show
  1. package/README.md +39 -0
  2. package/bin/cli.js +34 -0
  3. package/package.json +28 -0
  4. package/template/backend-project/.env +0 -0
  5. package/template/backend-project/.eslintrc.js +6 -0
  6. package/template/backend-project/.prettierrc +14 -0
  7. package/template/backend-project/README.md +1 -0
  8. package/template/backend-project/package-lock.json +1448 -0
  9. package/template/backend-project/package.json +18 -0
  10. package/template/backend-project/src/app.js +36 -0
  11. package/template/backend-project/src/config/db.js +19 -0
  12. package/template/backend-project/src/config/db.sql +10 -0
  13. package/template/backend-project/src/controllers/authCont.js +136 -0
  14. package/template/backend-project/src/middleware/authMiddleware.js +17 -0
  15. package/template/backend-project/src/routes/authRoutes.js +32 -0
  16. package/template/frontend-project/README.md +16 -0
  17. package/template/frontend-project/eslint.config.js +21 -0
  18. package/template/frontend-project/index.html +13 -0
  19. package/template/frontend-project/package-lock.json +3102 -0
  20. package/template/frontend-project/package.json +32 -0
  21. package/template/frontend-project/public/favicon.svg +1 -0
  22. package/template/frontend-project/public/icons.svg +24 -0
  23. package/template/frontend-project/src/App.css +0 -0
  24. package/template/frontend-project/src/App.jsx +31 -0
  25. package/template/frontend-project/src/Layout.jsx +34 -0
  26. package/template/frontend-project/src/api/authAPI.js +11 -0
  27. package/template/frontend-project/src/assets/hero.png +0 -0
  28. package/template/frontend-project/src/assets/react.svg +1 -0
  29. package/template/frontend-project/src/assets/vite.svg +1 -0
  30. package/template/frontend-project/src/components/Login.jsx +79 -0
  31. package/template/frontend-project/src/components/NotFound.jsx +16 -0
  32. package/template/frontend-project/src/components/ProtectedRoute.jsx +29 -0
  33. package/template/frontend-project/src/components/Register.jsx +131 -0
  34. package/template/frontend-project/src/context/AuthContext.jsx +93 -0
  35. package/template/frontend-project/src/index.css +11 -0
  36. package/template/frontend-project/src/main.jsx +10 -0
  37. package/template/frontend-project/src/pages/Dashboard.jsx +18 -0
  38. package/template/frontend-project/vite.config.js +8 -0
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Project Starter
2
+
3
+ Minimal session-based auth starter using Express, MySQL, React, Vite, and React Router.
4
+
5
+ ## Features
6
+ - Register with name, email, password
7
+ - Login with email and password
8
+ - Session-based authentication
9
+ - MySQL database
10
+ - Vite React frontend
11
+ - Protected dashboard
12
+ - Logout button
13
+
14
+ ## Setup
15
+
16
+ 1. Create the database and tables:
17
+ ```bash
18
+ mysql -u root -p < db.sql
19
+ ```
20
+
21
+ 2. Copy environment file:
22
+ ```bash
23
+ cp .env.example .env
24
+ ```
25
+
26
+ 3. Install dependencies: `backend-project and frontend-projec`
27
+ ```bash
28
+ npm install
29
+ ```
30
+
31
+ 4. Run locally:
32
+ ```bash
33
+ npm run dev
34
+ ```
35
+
36
+ ## Notes
37
+ - Backend runs on `http://localhost:5000`
38
+ - Frontend runs on Vite default port `http://localhost:5173`
39
+ - Vite proxies `/api` to the backend# project-starup
package/bin/cli.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require("path");
4
+ const fs = require("fs-extra");
5
+ const prompts = require("prompts");
6
+
7
+ async function main() {
8
+ const response = await prompts({
9
+ type: "text",
10
+ name: "projectName",
11
+ message: "Project name",
12
+ initial: "project-startup"
13
+ });
14
+
15
+ const projectName = response.projectName?.trim();
16
+ if (!projectName) process.exit(1);
17
+
18
+ const targetDir = path.resolve(process.cwd(), projectName);
19
+ const templateDir = path.resolve(__dirname, "../template");
20
+
21
+ if (await fs.pathExists(targetDir)) {
22
+ console.error(`Folder already exists: ${projectName}`);
23
+ process.exit(1);
24
+ }
25
+
26
+ await fs.copy(templateDir, targetDir);
27
+ console.log(`Created ${projectName}`);
28
+ console.log(`Next: cd ${projectName} && npm install && npm run dev`);
29
+ }
30
+
31
+ main().catch((err) => {
32
+ console.error(err);
33
+ process.exit(1);
34
+ });
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "project-startup",
3
+ "version": "1.0.0",
4
+ "description": "Minimal session-based auth starter using Express, MySQL, React, Vite, and React Router.",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "project-startup": "bin/cli.js"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/D3lt-a/project-starup.git"
15
+ },
16
+ "dependencies": {
17
+ "fs-extra": "^11.3.0",
18
+ "prompts": "^2.4.2"
19
+ },
20
+ "keywords": [],
21
+ "author": "",
22
+ "license": "ISC",
23
+ "type": "commonjs",
24
+ "bugs": {
25
+ "url": "https://github.com/D3lt-a/project-starup/issues"
26
+ },
27
+ "homepage": "https://github.com/D3lt-a/project-starup#readme"
28
+ }
File without changes
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ env: { node: true, es6: true },
3
+ extends: 'eslint:recommended',
4
+ parserOptions: { ecmaVersion: 12, sourceType: 'module' },
5
+ rules: { semi: ['error', 'always'], quotes: ['error', 'single'] },
6
+ };
@@ -0,0 +1,14 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "trailingComma": "es5",
5
+ "printWidth": 100,
6
+ "tabWidth": 2,
7
+ "useTabs": false,
8
+ "arrowParens": "always",
9
+ "bracketSpacing": true,
10
+ "endOfLine": "lf",
11
+ "jsxSingleQuote": false,
12
+ "quoteProps": "as-needed",
13
+ "proseWrap": "preserve"
14
+ }
@@ -0,0 +1 @@
1
+ # Backend Project