Share your thoughts, whims and opinions with humanity
Node.js version 18 or later
git clone https://github.com/sprioleau/2cents.dev.git
From the root directory, run the following command to install server dependencies.
npm install
I wrote a database seeding script (server/seed.js
) that you can run with the following command. This will add a few messages to the UI for testing out the application.
npm run db:seed
Next, run the application locally with the following command. The application will run on port 3000
.
npm run dev
Run the tests and view results in terminal. Note that this test script runs the application on port 3000
and performs test using a headless browser. So, this script should only be used when the application is not already running on port 3000
.
npm run test
Run the tests and view the results in an interactive UI.
npm run test:ui
- 🟦 Built with TypeScript
- ⚛️ Uses React Hooks to encapsulate logic
- 🎨 Fully custom design inspired by MailChimp brand colors
- ⚡️ Performant sorting of messages at database level
- 💫 Subtle animations
- 🧪 Fully configured end-to-end test suite
- 🏗️ Semantic HTML
- 📱 Mobile responsive design
With more time given to this project, I would consider the following ideas and features.
- Bring in Framer Motion for tasteful animations that add delight
- Use newly created comment and append it to UI instead of fetching entire list after a new comment is created
- Consider implementing optimistic UI if database queries slow with scale (React's
useOptimistic
hook is one option)
- Consider implementing optimistic UI if database queries slow with scale (React's
- Add a
users
table secured with a user authentication strategy and data access controls - Break out code into small commits/PRs to better explain intention
- Convert all server code to TypeScript
- Update message timestamps (
created
field) on a recurring interval so that UI updates without interaction- Use TanStack Query for fetching on window focus and add polling interval
- Add ability to edit messages
- Implement better error handling strategy and add toast messages
- Imhanced testing strategy
- Use React Testing Library for individual component tests where valuable
- Consider adding unit tests for utility functions
- Consider using Mock Service Worker (MSW) to test API without needing to spin up a headless browser via Playwright
- Add tests to CI pipeline via GitHub actions
- Revisit button styles and states
- Check application with assistive technologies
- Fully deploy API
- Simple emoji reactions with a count
- Add ability to reply to a comment (consider maximum level of nesting)
A link to the Figma design file for this application is below.
Technology | Used For |
---|---|
TypeScript | - |
Express | API routing |
React | Building UI |
Playwright | End-toend Testing |
Zod | Schema validation |