This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
README.md
96 lines (68 loc) · 2.44 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# actix-graphql-react
**NOT** complete - Clean boilerplate for GraphQL server & react-app built with Rust & TypeScript.
* Backend Demo (WIP): https://api.budshome.com/gql
* Frontend Demo (WIP): https://cms.budshome.com
## Features
- [x] DB migration with Diesel
- [x] User: query & mutation
- [x] Project: query & mutation
- [x] User register
- [ ] Sign up & Sign in
- [ ] Encrypt password & Change password
- [ ] Profile Update
- [ ] JSON web token authentication
## Stacks
### Backend
- [Rust](https://www.rust-lang.org/zh-CN),[Rust 实例手册](https://books.budshome.com/rust-cookbook),[Rust 参考手册](https://books.budshome.com/rust-reference),[通过例子学 Rust](https://books.budshome.com/rust-by-example),[Rust 程序设计语言(2018)](https://books.budshome.com/rust-lang)
- [actix-web](https://crates.io/crates/actix-web) - Web server
- [juniper](https://crates.io/crates/juniper) - GraphQL server,[juniper 中文文档](https://books.budshome.com/juniper)
- [diesel](https://crates.io/crates/diesel) - ORM
- [PostgreSQL](https://postgresql.org) / [MySql](https://dev.mysql.com) - Database
- [jsonwebtoken](https://crates.io/crates/jsonwebtoken) - JSON Web Token
- [GraphQL Playground](https://github.com/prisma-labs/graphql-playground) - GraphQL UI
### Frontend
- [TypeScript](https://www.typescriptlang.org)
- [react](https://zh-hans.reactjs.org) - User Interfaces
- [apollo-client](https://www.apollographql.com/docs/react) - GraphQL client
## How to run?
### Backend
``` Bash
git clone https://github.com/zzy/actix-graphql-react.git
cd actix-graphql-react/backend/
```
#### Put the `DATABASE_URL` & `port` in a `.env` file.
Configure the database backend in Cargo.toml:
``` Toml
[dependencies]
diesel = { version = "<version>", features = ["<postgres|mysql>"] }
```
Then, run at the bash:
``` Bash
cargo install diesel_cli --no-default-features --features <postgres|mysql>
echo DATABASE_URL=<postgres|mysql>://username:password@localhost/actix_graphql > .env
echo GRAPHQL_PORT=5000 >> .env
```
#### Build & Release
- Build
``` Bash
diesel setup
diesel migration run
cargo build
cargo run
```
- Release
``` Bash
cargo build --release
cd target/release
./actix-graphql-react
```
GraphiQL: connect to http://localhost:5000/gql with browser.
### Frontend
``` Bash
git clone https://github.com/zzy/actix-graphql-react.git
cd actix-graphql-react/frontend/
# npm or yarn
<npm|yarn> install
<npm|yarn> start
```
Then go to http://localhost:5001