A Rust web server with GraphQL API, Diesel, PostgreSQL and JWT authentication.
This repository contains boilerplate rust code for getting a GraphQL prototype with JWT up and running quickly.
It uses actix-web, Juniper, Diesel and jsonwebtoken
Your own pull requests are welcome!
▶ ./bombardier -c 125 -n 10000000 http://localhost:3000/graphql -k -f body --method=POST -H "Content-Type: application/json" -s
Bombarding http://localhost:3000/graphql with 10000000 request(s) using 125 connection(s)
10000000 / 10000000 [===========================================================================] 100.00% 28777/s 5m47s
Done!
Statistics Avg Stdev Max
Reqs/sec 28788.66 2183.47 34605.95
Latency 4.32ms 543.07us 110.95ms
HTTP codes:
1xx - 0, 2xx - 10000000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 20.75MB/s- actix - link
- actix-web - link
- diesel - link
- juniper - link
- chrono - link
- serde_json - link
- argon2rs - link
- jsonwebtoken - link
- Rustup
- Nightly Toolchain:
rustup default nightly - Diesel cli with postgres
cargo install diesel_cli --no-default-features --features "postgres" - PostgreSQL database server or use our docker-compose.yml (require docker)
git clone https://github.com/clifinger/canduma.git
cd canduma
docker-compose up
cp .env.example .env
diesel setup --database-url='postgres://postgres:canduma@localhost/canduma'
diesel migration run
cargo run############ GraphQL Queries ############
mutation MemberRegister($registerInput: RegisterInput!) {
register(input: $registerInput) {
name
email
uuid
}
}
mutation MemberLogin($loginInput: LoginInput!) {
login(input: $loginInput) {
bearer
user {
name
uuid
createdAt
email
}
}
}
query MembersQuery {
users {
createdAt
name
email
uuid
}
}
############ Query Variables ############
{
"registerInput": {
"email": "me@me.me",
"name": "John Doe",
"password": "canduma"
},
"loginInput": {
"email": "me@me.me",
"password": "canduma"
}
}
cargo build --release
cd target/release
./canduma