# Database
- to populate db with fake data from `./fake-data`, issue this:
```sql
# 3. Seed with testing data
# TODO we should not seed db with this data. Remove all this files,
# but y...
**Chat comments pagination**: autoloading of comments on Mixlr is implemented as follows: you scroll 50 messages, than React detects the end of display messages and shows "loading" bar, retrieving ...
**HTTP Auth (cookie session)**
Assume the situation: I had flushed my Redis db, deleting all current sessions. What now happens to logged in users?
When they type in chat input field and press "S...
- **denial of service attack** — implement rate limiting — store everything in Redis
- Additionally, to prevent an attacker that did not steal your database from renting a bot net and brute-forc...
- Improve db perfomance (I've already saved these links, you can delete them here):
- [PostgreSQL Indexes: First Principles](https://ieftimov.com/post/postgresql-indexes-first-principles/)
- [...
- Creating user settings schema
- [Dtabase design for user settings](https://stackoverflow.com/questions/10204902/database-design-for-user-settings/10228192)
- [Guide to design database for RB...
**Sockets and authentication** ([stackoverflow](https://stackoverflow.com/questions/59813719/how-can-i-store-websocket-client-obj-on-redis-database)): When server restart all connected clients will...
**(this feature might be already implemented!)**
Chat (WebSockets)
**How to get old messages when new user connects to chat?** Store all messages in db and upon new user connection send him JSON ...
Protect you API from spam bots that automatically create empty accounts:
* implement reCaptcha for web users (much more important then rate limiting!)
* do smth else
[How to protect /signup...
In future it is better to extract the `email_confirmation_token` field in database to separate table and add to it `created_at` field. Then you will be able to delete signup email confirmation toke...
I haven't thought through of what happends when client is in the process of reseting his email and tries to connect over websocket. Maybe everything is fine, you just need to test and diagram possi...
For superadmin user management create a separate server listening on a different port + allow requests to the VPS server on this port only from specific IPs, etc. (read OWASP "REST API Security Gui...
For broadcaster, there should be only JWT auth, because what will happen if I logged in (created session), stream, and at the same time try to log in via UI. The second session will be created or w...
Fronted: currently if use is authenticated but browser havent set the cookie (alothough the server set it), the user gets logged in. This leads to errors when this authenticated user sends request ...
Use case: The user has signed up, we sent him email confirmation link, but he lost it. So he want that we resend hi a link. What to do? Currently my app doesn't handle such edge case.
- **SQL data model (naming tables)/naming things in app/naming api endpoints**: read how mixlr does this
- http://help.mixlr.com/en/articles/1075004-recording-your-mixlr-broadcast
- http://hel...
Check all your SQL queries for race conditions — I think you should edit all functions where your have two database calls and refactor them in transaction, because between first and second databate...
**Frontend Architecture**
If you feel like there are problems with frontend routing you can try to architect it better with these articles
- [example of routing with auth](https://stackoverflow.c...
**WebSocket Endpoint** — When you started streaming send signal though WS to client to reconnect to `/live` endpoint, thus when you start streaming all clients will get new stream without having to...
There can be situations where the user has successfully registered but my email service (Yandex) is down/errors/or doesnt work for some other reason. I need to implement retry function to send conf...