Skip to content

Commit 7cd3ef4

Browse files
committed
UPD Codebase
1 parent 20b2fe0 commit 7cd3ef4

File tree

201 files changed

+48894
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+48894
-0
lines changed

README.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# [NodeJS React Datta Able](https://appseed.us/product/datta-able/api-server-nodejs/react/)
2+
3+
Full-Stack Seed project generated by **[React App Generator](https://appseed.us/generator/react/)** on top of *Datta Able* design from **[CodedThemes](https://codedthemes.com/?ref=appseed)**.
4+
The backend logic is provided by a simple, `easy-to-extend` API Server that manages the Authentication flow (login, registration, logout) using `JSON Web Tokens` (JWT).
5+
6+
- 👉 [NodeJS React Datta Able](https://appseed.us/product/datta-able/api-server-nodejs/react/) - `Product Page`
7+
- 👉 [NodeJS React Datta Able](https://react-node-js-datta-able.appseed-srv1.com) - `LIVE Demo`
8+
9+
![React Datta Able - Full-Stack Starter generated by AppSeed.](https://user-images.githubusercontent.com/51070104/174488189-7bbb3e82-b319-487e-94ec-e295aca3f6d7.png)
10+
11+
<br >
12+
13+
## `React` Datta Able
14+
15+
- Modern aesthetics UI design - Designed by *[CodedThemes](https://codedthemes.com/?ref=appseed)*
16+
- React, Redux, Redux-persist
17+
18+
<br />
19+
20+
> `Tests` (compatibility matrix)
21+
22+
| NodeJS | NPM | YARN |
23+
| --- | --- | --- |
24+
| `v14.0.0` |||
25+
| `v16.0.0` |||
26+
| `v18.0.0` |||
27+
28+
29+
<br />
30+
31+
## `NodeJS API` Features
32+
33+
- Stack: `NodeJS` / `Express` / **SQLite**
34+
- `TypeScript`, Joy for validation
35+
- **DB Layer**: `TypeORM`, `SQLite` persistence
36+
- **Auth**: Passport / `passport-jwt` strategy
37+
- [API Definition](https://docs.appseed.us/boilerplate-code/api-unified-definition) - the unified API structure implemented by this server
38+
39+
<br />
40+
41+
> `Tests` (compatibility matrix)
42+
43+
| NodeJS | NPM | YARN |
44+
| --- | --- | --- |
45+
| `v18.0.0` |||
46+
| `v17.0.0` |||
47+
| `v16.13.0` |||
48+
| `v16.0.0` |||
49+
50+
51+
<br />
52+
53+
## ✨ How to use it
54+
55+
Being a full-stack product, the backend and the frontend should be compiled and started separately.
56+
Before starting to compile the product, make sure you have the following tools installed in the environment:
57+
58+
- [NodeJS](https://nodejs.org/en/) - version `14.x` or higher
59+
- [GIT](https://git-scm.com/) - used to clone tjhe sources from Github
60+
- [Python3](https://www.python.org/) - used in many tools
61+
62+
<br />
63+
64+
### 👉 Start the Frontend
65+
66+
> **Step 1** - Once the project is downloaded, change the directory to `react-ui`.
67+
68+
```bash
69+
$ cd react-ui
70+
```
71+
72+
<br >
73+
74+
> **Step 2** - Install dependencies via NPM or yarn
75+
76+
```bash
77+
$ npm i
78+
// OR
79+
$ yarn
80+
```
81+
82+
<br />
83+
84+
> **Step 3** - Start in development mode
85+
86+
```bash
87+
$ npm run start
88+
// OR
89+
$ yarn start
90+
```
91+
92+
<br />
93+
94+
At this point, the app is available in the browser `localhost:3000` (the default address).
95+
96+
97+
<br />
98+
99+
### 👉 Start the Backend Server
100+
101+
> **Step 1** - Change the directory to `api-server-nodejs`
102+
103+
```bash
104+
$ cd api-server-nodejs
105+
```
106+
107+
<br >
108+
109+
> **Step 2** - Install dependencies via NPM or yarn
110+
111+
```bash
112+
$ npm i
113+
// OR
114+
$ yarn
115+
```
116+
117+
<br />
118+
119+
> **Step 3** - Run the SQLite migration via TypeORM
120+
121+
```bash
122+
$ npm run typeorm migration:run
123+
// OR
124+
$ yarn typeorm migration:run
125+
```
126+
127+
<br />
128+
129+
> **Step 4** - Start the API server (development mode)
130+
131+
```bash
132+
$ npm run dev
133+
// OR
134+
$ yarn dev
135+
```
136+
137+
The API server will start using the `PORT` specified in `.env` file (default 5000).
138+
139+
<br />
140+
141+
## 👉 Codebase Structure
142+
143+
```bash
144+
< ROOT / src >
145+
|
146+
|-- config/
147+
| |-- config.ts # Configuration
148+
| |-- passport.ts # Define Passport Strategy
149+
|
150+
|-- migration/
151+
| |-- some_migration.ts # database migrations
152+
|
153+
|-- models/
154+
| |-- activeSession.ts # Sessions Model (Typeorm)
155+
| |-- user.ts # User Model (Typeorm)
156+
|
157+
|-- routes/
158+
| |-- users.ts # Define Users API Routes
159+
|
160+
|
161+
|-- index.js # API Entry Point
162+
|-- .env # Specify the ENV variables
163+
|
164+
|-- ************************************************************************
165+
```
166+
167+
<br />
168+
169+
## 👉 SQLite Path
170+
171+
The SQLite Path is set in `.env`, as `SQLITE_PATH`
172+
173+
<br />
174+
175+
## 👉 Database migration
176+
177+
> Generate migration:
178+
179+
```bash
180+
$ yarn typeorm migration:generate -n your_migration_name
181+
```
182+
183+
> run migration:
184+
185+
```bash
186+
$ yarn typeorm migration:run
187+
```
188+
189+
<br />
190+
191+
## [React Datta Able](https://appseed.us/product/datta-able-pro/full-stack/) `PRO Version`
192+
193+
> For more components, pages and priority on support, feel free to take a look at this amazing starter:
194+
195+
Datta Able is a premium React Design now available for download as a full-stack app. Made of hundred of elements, designed blocks, and fully coded pages, Datta Able PRO is ready to help you create stunning websites and web apps.
196+
197+
- 👉 [React Datta Able PRO](https://appseed.us/product/datta-able-pro/full-stack/) - Product Page
198+
-`Enhanced UI` - more pages and components
199+
-`Priority` on support
200+
201+
![React Datta Able PRO - Full-Stack Starter generated by AppSeed.](https://user-images.githubusercontent.com/51070104/174492290-a581dc5f-6b4a-4f5e-822e-419a8b96a480.png)
202+
203+
<br />
204+
205+
---
206+
**React Datta Able** - Full-Stack Seed project generated by **[App Generator](https://appseed.us/generator/)**.

api-server-nodejs/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NODE_ENV=DEV
2+
PORT=5000
3+
SQLITE_PATH=./database.db
4+
SECRET="SuperS3cret_4277m"

api-server-nodejs/.eslintrc.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
env: {
3+
es2021: true,
4+
node: true,
5+
},
6+
extends: ['airbnb-typescript/base', 'plugin:@typescript-eslint/recommended'],
7+
parser: '@typescript-eslint/parser',
8+
parserOptions: {
9+
ecmaVersion: 2018,
10+
sourceType: 'module',
11+
project: './tsconfig.json',
12+
},
13+
rules: {
14+
'@typescript-eslint/explicit-module-boundary-types': 'off',
15+
'no-param-reassign': 'off',
16+
'no-underscore-dangle': 'off',
17+
'consistent-return': 'off',
18+
'no-console': 'off',
19+
'import/prefer-default-export': 'off',
20+
'@typescript-eslint/no-non-null-assertion': 'off',
21+
'class-methods-use-this': 'off',
22+
'@typescript-eslint/naming-convention': 'off'
23+
},
24+
};

api-server-nodejs/.gitattributes

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Declare files that will always have LF line endings on checkout.
2+
3+
*.html text eol=lf
4+
*.scss text eol=lf
5+
*.sass text eol=lf
6+
*.css text eol=lf
7+
*.js text eol=lf
8+
*.json text eol=lf
9+
*.svg text eol=lf
10+
*.yml text eol=lf
11+
*.yaml text eol=lf
12+
*.md text eol=lf
13+
14+
.babelrc text eol=lf
15+
.gitignore text eol=lf
16+
.gitattributes text eol=lf
17+
18+
LICENSE text eol=lf
19+
20+
# Denote all files that are truly binary and should not be modified.
21+
22+
*.png binary
23+
*.jpg binary
24+
*.jpeg binary
25+
*.gif binary
26+
*.bmp binary
27+
*.ai binary
28+
*.psd binary
29+
*.pdf binary
30+
31+
*.otf binary
32+
*.eot binary
33+
*.ttf binary
34+
*.woff binary
35+
*.woff2 binary
36+
*.zip binary
37+
*.rar binary

api-server-nodejs/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules
2+
build
3+
4+
# Logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
10+
*.db

api-server-nodejs/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v14

api-server-nodejs/CHANGELOG.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Change Log
2+
3+
## [v1.0.3] 2022-11-08
4+
### Improvements
5+
6+
- Save Compat matrix in `package.json`
7+
- `build` node
8+
- Yarn, NPM
9+
- NodeJS versions
10+
11+
## [v1.0.2] 2022-11-06
12+
### Improvements
13+
14+
- Updated for Deploy on RENDER using [Python Deployer](https://github.com/app-generator/deploy-automation-render)
15+
- `python.exe .\deployer.py nodejs https://github.com/app-generator/api-server-nodejs`
16+
- The new API is usable via `https://api-server-nodejs-<RANDOM>.onrender.com/api/`
17+
18+
## [v1.0.1] 2022-06-02
19+
### Improvements
20+
21+
- Dependencies Update for
22+
- NodeJS `v17.0.0`
23+
- NodeJS `v16.15.1`
24+
25+
## [v1.0.0] 2021-07-20
26+
### Stable release
27+
28+
- Persistance migrated to SQLite3 / TypeORM
29+
- Stack: Node JS/ Express / TypeORM / SQLite3
30+
- API:
31+
- Sign UP: `/api/users/register`
32+
- Sign IN: `/api/users/login`
33+
- Logout: `/api/users/logout`
34+
- Check Session: `/api/users/checkSession`
35+
- Edit User: `/api/users/edit`
36+
- Data persistence
37+
- TypeORM / SQLite3
38+
- Db migrations are in `src/migrations` folder
39+
- Added new config `ormconfig.json`
40+
41+
## [0.0.9] 2021-07-19
42+
### Production Update
43+
44+
- Use `pm2` in production - new targets added to `package.json`
45+
- `start` uses `pm2` to start
46+
- `start-node` - load typescript build with Node JS
47+
48+
## [0.0.8] 2021-07-09
49+
### Improvements & Fixes
50+
51+
- Patch #8: Typescript Migration - Tests are failing
52+
- Code refactoring:
53+
- `src/config/keys.ts` - removed
54+
- `keys.ts` variables moved to `.env`
55+
56+
## [0.0.7] 2021-07-09
57+
### Improvements
58+
59+
- Added typescript support
60+
61+
## [0.0.6] 2021-07-07
62+
### Improvements
63+
64+
- Deprecate `src/app.js` - now the app is constructed by:
65+
- `src/server/index.js`
66+
- `src/index.js`
67+
- Integrate JTest: `yarn test`
68+
69+
## [0.0.5] 2021-07-05
70+
### Improvements
71+
72+
- Move sources to `src` folder
73+
- Dockerize project (unstable) - See issue [#6](https://github.com/app-generator/api-server-nodejs/issues/6)
74+
75+
## [0.0.4] 2021-07-04
76+
### Improvements
77+
78+
- Use `Joy` as input validator for `login` & `register`
79+
- Remove `bodyParser` dependency (flagged as deprecated)
80+
81+
## [0.0.3] 2021-07-04
82+
### Complete rewrite
83+
84+
- Update Passport strategy to `JwtStrategy`
85+
- Persistance via MongoDB
86+
- API:
87+
- Sign UP: `/api/users/register`
88+
- Sign IN: `/api/users/login`
89+
- Logout: `/api/users/logout`
90+
- Check Session: `/api/users/checkSession`
91+
- Edit User: `/api/users/edit`
92+
- Merge PR #5 - Added `nodemon` to `devDependencies`
93+
94+
## [0.0.2] 2021-07-03
95+
### Improvements & Fixes
96+
97+
- Patch #3 - Error when installing modules
98+
- Patch #2 - Passport Authentication always returns missing credentials
99+
- Remove `body-parser` dependency
100+
101+
## [0.0.1] 2021-07-03
102+
### Improvements
103+
104+
- Update Dependencies
105+
- Update License file
106+
- Add CHANGELOG.md to track all changes

0 commit comments

Comments
 (0)