Skip to content

Commit 13dd77a

Browse files
committed
feat: init project
1 parent b9ccde2 commit 13dd77a

File tree

150 files changed

+7226
-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.

150 files changed

+7226
-0
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
TENCENT_SECRET_ID=xxx
2+
TENCENT_SECRET_KEY=xxx
3+
4+
REGION=ap-guangzhou
5+
VPC_ID=xxx
6+
SUBNET_ID=xxx

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.env
2+
node_modules
3+
yarn.lock
4+
package-lock.json

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npm.taobao.org/

README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Admin System
2+
3+
[Demo](https://sls-admin.yugasun.com/)
4+
5+
This is an admin system developed by [Serverless Components](https://github.com/serverless/components).
6+
7+
This template includes:
8+
9+
- **Serverless RESTful API**: Using
10+
[@serverless/tencent-egg](https://github.com/serverless-components/tencent-egg)
11+
component, it contains a Servelress Cloud Function and a single API Gateway
12+
endpoint.
13+
14+
- **Serverless website using Vue.js**:
15+
[@serverless/tencent-website](https://github.com/serverless-components/tencent-website),
16+
it deploys all static files to Cloud Object Storage, and config CDN domain.
17+
18+
> **Notice**: The frontend project is initialed by [@vue/cli](https://cli.vuejs.org/) which is official standard tooling for Vue.js development.
19+
20+
### Content
21+
22+
1. [Prepare](#Prepare)
23+
2. [Download](#Download)
24+
3. [Bootstrap](#Bootstrap)
25+
4. [Deploy](#Deploy)
26+
5. [Development](#Development)
27+
28+
### Prepare
29+
30+
Before all below steps, you should install
31+
[Serverless Framework](https://www.github.com/serverless/serverless) globally:
32+
33+
```bash
34+
$ npm i serverless -g
35+
```
36+
37+
### Download
38+
39+
Severless cli is very convenient, it can download templates in any github
40+
project.
41+
42+
```bash
43+
$ serverless create --template-url https://github.com/yugasun/serverless-admin-system
44+
```
45+
46+
### Bootstrap
47+
48+
Copy `.env.example` file to `.env` in project root:
49+
50+
Add the access keys of a
51+
[Tencent CAM Role](https://bash.cloud.tencent.com/cam/capi) with
52+
`AdministratorAccess` in the `.env` file, like below:
53+
54+
```dotenv
55+
# .env
56+
TENCENT_SECRET_ID=xxx
57+
TENCENT_SECRET_KEY=xxx
58+
59+
REGION=ap-guangzhou
60+
VPC_ID=xxx
61+
SUBNET_ID=xxx
62+
```
63+
64+
Install the NPM dependencies:
65+
66+
```bash
67+
$ npm run bootstrap
68+
```
69+
70+
### Deploy
71+
72+
Deploy via the `serverless` command:
73+
74+
```bash
75+
$ serverless deploy
76+
```
77+
78+
Use the `--debug` flag if you'd like to learn what's happening behind the
79+
scenes:
80+
81+
```bash
82+
$ serverless deploy --debug
83+
```
84+
85+
### Development
86+
87+
After your first deployment, you will be able to run the frontend locally and
88+
have it communicate to the live backend in the cloud.
89+
90+
```bash
91+
$ yarn start
92+
```
93+
94+
### Notice
95+
96+
Because this project, you should create a [MySQL](https://bash.cloud.tencent.com/cdb) and [Redis](https://bash.cloud.tencent.com/redis) on Tencent Cloud.
97+
98+
And you should create a `.env` file in `backend`
99+
folder, and set all required parameters like `.env.example`.
100+
101+
### License
102+
103+
MIT

backend/.autod.conf.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
3+
module.exports = {
4+
write: true,
5+
prefix: '^',
6+
plugin: 'autod-egg',
7+
test: [
8+
'test',
9+
'benchmark',
10+
],
11+
dep: [
12+
'egg',
13+
'egg-scripts',
14+
],
15+
devdep: [
16+
'egg-ci',
17+
'egg-bin',
18+
'egg-mock',
19+
'autod',
20+
'autod-egg',
21+
'eslint',
22+
'eslint-config-egg',
23+
],
24+
exclude: [
25+
'./test/fixtures',
26+
'./dist',
27+
],
28+
};
29+

backend/.env.example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# mysql env
2+
DB_HOST=xxx
3+
DB_PORT=xxx
4+
DB_NAME=xxx
5+
DB_USER=xxx
6+
DB_PASSWORD=xxx
7+
8+
# redis env
9+
REDIS_HOST=xxx
10+
REDIS_PORT=xxx
11+
REDIS_PASSWORD=xxx
12+
13+
14+
# authing app config, get from https://authing.cn/dashboard/clients/5e44f4be324d8ade34cba121/connections/OIDCProvider
15+
AUTHING_APPID=xxx
16+
AUTHING_APPSECRET=xxx

backend/.env.local

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
DB_HOST=127.0.0.1
2+
DB_PORT=3306
3+
DB_NAME=eggAdmin
4+
DB_USER=root
5+
DB_PASSWORD=root
6+
7+
# redis env
8+
REDIS_HOST=127.0.0.1
9+
REDIS_PORT=6379
10+
REDIS_PASSWORD=''
11+
12+
# authing app config
13+
AUTHING_APPID=5e44f4bf31466018397e69b5
14+
AUTHING_APPSECRET=8cda15e6e0066675e9d2a6e9e0d5f625

backend/.eslintignore

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

backend/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "eslint-config-egg"
3+
}

backend/.sequelizerc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
const path = require('path');
4+
5+
module.exports = {
6+
config: path.join(__dirname, 'database/config.json'),
7+
'migrations-path': path.join(__dirname, 'database/migrations'),
8+
'seeders-path': path.join(__dirname, 'database/seeders'),
9+
'models-path': path.join(__dirname, 'app/model'),
10+
};

0 commit comments

Comments
 (0)