async-labs / saas

Build your own SaaS business with SaaS boilerplate. Productive stack: React, Material-UI, Next, MobX, WebSockets, Express, Node, Mongoose, MongoDB. Written with TypeScript.
https://saas-app.async-await.com
MIT License
4.11k stars 682 forks source link

What could cause the app to be so laggy? #200

Open OB42 opened 1 year ago

OB42 commented 1 year ago

Hi, I wanted to try out the project, set up everything, the only change I made was reactivating regular passwordless mail login. I use a M1 macbook pro, the atlas mongodb is M0(the free version, should I get a paid one?) I have multiple seconds of loading on every single page. Is that normal?it's so sluggish for what it actually does Any advice would be appreciated, Thanks

tima101 commented 1 year ago

@OB42 Try local database instead of remote.


Once you install mongod and mongosh locally, here are some commands you may find useful:

sudo mongod --auth --port 27017 --dbpath /var/lib/mongodb

Create user and grant permission:

use admin
db.createUser(
  {
    user: "myUserAdmin",
    pwd: "123XXXXXXXXXXX",
    roles: [
    { role: "root", db: "admin" },
    { role: "userAdminAnyDatabase", db: "admin" },
    { role: "readWriteAnyDatabase", db: "admin" }
    ]
  }
)
db.grantRolesToUser("myUserAdmin", ["root"]);
sudo mongosh --port 27017  --authenticationDatabase "admin" -u "myUserAdmin" -p

Connection string for MongoDB Compass and env var:

mongodb://myUserAdmin:123XXXXXXXXXXX@localhost:27017/?authSource=admin&readPreference=primary&ssl=false

Let me know how it goes.