The app will be a full-stack, multi-user wiki application, basically a simplified Wikipedia.
- Front end: React with React Router and the marked library for rendering markdown
- Back end:
- Node/Express/express-session for the API
- Mongo/Mongoose for the database layer
- Hosting: Render free tier, Mongo Atlas
- Users can sign up, log in, view, create and modify wiki articles
- Users can search across all wiki titles, see a page of results and click to open a specific article
- Wiki articles will have a route like
/article/slug-titlewhereslug-titleis created and stored in the DB as a unique, normalized (lower kebab-cased) identifier - User editing will be markdown-based, with a live preview similar to GitHub gists
- Submitting an edit appends a new version to the list of previous idempotent edits
- Each wiki article has a history of versions that can be viewed, with version timestamps and the user creating the new version
- Extremely minimal styling, just basic flexbox layouts, dark/light mode with
<meta name="color-scheme" content="dark light"> - Anyone can view any article or history, but only logged in users see editing options, also enforced on the backend with protected routes
- Social elements, like following users, favoriting articles or discussions
- Paginated search results, deep search within article text, fuzzy search, tags
- User account recovery, password changing or user profile/settings
- Ability to modify article history or delete articles
- Version diff displays
- Image/attachment uploading, except when hosted third-party as markdown links
- Fancy editing features, like diagrams, latex or audio
- Restoring previous versions of articles
- Testing
- Collaborative editing
- Validation of requests/error handling for badly formed API requests (we will enforce DB constraints/auth only)
- Rate limiting or capping the number of articles or edits made by users
- Users
- POST
/api/userscreates a user - GET
/api/users/:idreturns a user by id - POST
/api/users/loginlogs a user in - POST
/api/users/logoutlogs a user out
- POST
- Articles
- POST
/api/articlescreates an article - GET
/api/articles/:slugreturns an article by slug - POST
/api/articles/:slug/versionupdates an article by creating a new version - GET
/api/articles/:slug/versionreturns the history of edits for an article - GET
/api/articles/:slug/history/:idreturns a specific version for an article - GET
/api/articles/search/:queryreturns the top 50 articles with:queryin the title
- POST
/landing page/loginform to log in/registerform to sign up/newshows a form to create a new article/search?q=foobarshows a list of search results with titles matchingfoobar/articles/:slugshows the latest version of an article with:slugor a 404 page if not found/articles/:slug/versionsshows article's list of versions/articles/:slug/versions/:idshows article's history by version id/articles/:slug/editshows article editing view- All other routes 404
- FE nav links to search bar, login/sign up when not logged in
- FE nav links to search bar, new article, sign out when logged in
User:- id, name, passwordHash
- All fields are immutable
Article:- id, title, slug, currentVersionId, createdAt
- All fields are immutable
- Always has at least one
ArticleVersion - The most recent
ArticleVersionis the current default shown
ArticleVersion:- id, body, articleId, userId, createdAt
- All fields are immutable
- An idempotent edit version of an article
- How will we handle session persistence?
- We can use express-session's Mongo connector
- How will we sanitize user input markdown to avoid XSS?
- We can use a library like dompurify
- Day 1 (all days 1 hour):
- set up the project IDE
- set up a GitHub repo
- set up Mongo Atlas
- install npm packages
- create Express/DB scaffolding
- Day 2:
- DB models
- article API routes
- article rendering (hardcode the first article)
- Day 3:
- article creation/editing (hardcoded user)
- Day 4:
- auth
- sessions
- Day 5:
- history/versioning UI
- Day 6:
- article title search
- markdown preview for create/edit
- Day 7:
- ui polish
- deploy to Render