StarTalk is a Calvin University themed forum application built for CS336. It features a "Hupu-style" (sports forum) UI with dark mode, rating systems, and real-time discussions.
- Hupu-Style UI: Custom dark theme with specific layout for comments and ratings.
- Rating System: Visual rating bars and summary statistics for topics.
- Real-time Discussions: Post and comment functionality powered by Firestore.
- User Management: Firebase Authentication integration.
- Permissions:
- Authors can delete their own posts.
- Commenters can delete their own comments.
- CI/CD: Automated deployment to Firebase Hosting via GitHub Actions.
This project meets the course requirements as follows:
- Web App: Yes, built with Angular 17.
- External UI Package: Uses
@angular/material. - Significant CSS Customization: Includes custom snow animation, global variables, and detailed component styling in
styles.scssand component stylesheets. - 3 of 4 Specific Features Implemented:
- ✅ At least 5 custom components: Includes 8 components (
add-post,comment-section,post-card,post-detail,post-list,rating,user-profile,weather-widget). - ✅ Full CRUD: Implemented in
PostService(Create, Read, Update, Delete). - ✅ Remote storage in Cloud Firestore: Uses
@angular/fire/firestoreconnected to apostscollection. - ❌ At least 5 pages to be routed to: (4 routed pages implemented (
PostListComponent,PostDetailComponent,UserProfileComponent,AddPostComponent)).
- ✅ At least 5 custom components: Includes 8 components (
The application is deployed and accessible at: https://startalk-99a78.web.app
- Frontend: Angular 17 (Standalone Components)
- Styling: SCSS, Angular Material
- Backend: Firebase (Firestore, Auth, Hosting)
- CI/CD: GitHub Actions
- Node.js (LTS version recommended)
- Angular CLI (
npm install -g @angular/cli)
- Clone the repository:
git clone https://github.com/Martin0101010101/startalk.git
- Navigate to the project directory:
cd startalk - Install dependencies:
npm install
Run the development server:
ng serveNavigate to http://localhost:4200/. The app will automatically reload if you change any source files.
This project is configured with GitHub Actions for continuous deployment.
- Automatic Deployment: Any push to the
mainbranch triggers a build and deploys the application to Firebase Hosting. - Live Site: https://startalk-99a78.web.app
src/app/components: UI Components (Comment section, Rating bars, etc.)firestore.indexes.json: Firestore index definitions for complex queries..github/workflows: CI/CD configuration files.
- Evidence:
RatingServiceusesreduceto calculate average ratings.PostServiceusesfilterto filter recent posts.CommentSectionComponentusesmapto transform distribution data for the UI.CommentSectionComponentusesmapto generate an array for star display.
- Evidence:
- Destructuring: Used in
server.ts(const { protocol... } = req). - Ternary Operator: Used in
CommentSectionComponentfor calculating percentages (distributionTotal > 0 ? ... : 0). - Short-circuiting: Used in
CommentServicefor validation (r.createdAt.seconds === reply.createdAt.seconds && ...).
- Destructuring: Used in
- Evidence:
UserServiceextensively usesasync/awaitandPromise<void>for profile updates (syncUserProfile,updateBio).PostCardComponentusestry/catchblocks withawaitto handle post liking errors.
AN9: Defend the usefulness of separating view (HTML) from logic, and view-logic from data-providing services
- Defense:
- Separation of Concerns: This project strictly follows Angular's architecture.
- View (HTML):
*.component.htmlfiles contain only the structure and display logic (bindings). - Logic (TS):
*.component.tsfiles handle user interaction and view state, keeping the UI responsive and testable. - Data (Services):
*.service.tsfiles (e.g.,PostService,AuthService) handle all data fetching and business logic. This allows the same data to be reused across multiple components (e.g.,PostServiceis used by bothPostListandPostDetail) and makes the app easier to maintain and scale.
- View (HTML):
- Separation of Concerns: This project strictly follows Angular's architecture.
- Reasoning:
- Flexbox: Used extensively (e.g.,
display: flexinstyles.scss,user-profile.component.scss) for 1-dimensional layouts like aligning items in a row (headers, rating stars) or centering content. It provides excellent control over alignment and space distribution. - CSS Grid: Used in
post-list.component.scss(display: grid) for 2-dimensional layouts, such as the main feed layout where we might want a sidebar and a main content area to align perfectly. - Comparison: Flexbox is chosen for component-level alignment (buttons, icons), while Grid is better for page-level structure.
- Flexbox: Used extensively (e.g.,
- Evidence:
- Inputs:
CommentSectionComponentuses@Input() postIdand@Input() postto receive data from the parentPostDetailComponent. - Outputs:
CommentSectionComponentuses@Output() commentAddedto notify the parent component when a new comment is successfully posted, allowing the parent to react (e.g., log or refresh).
- Inputs:
P1: Enumerate, compare, and contrast the various mechanisms websites can use to store data persistently
- Comparison:
- Cloud Firestore (Used): A NoSQL cloud database. It offers real-time synchronization, scalability, and easy integration with Angular. We chose this for StarTalk to enable live updates of posts and comments across all users.
- LocalStorage: Client-side key-value storage. Good for simple user preferences (like "dark mode" toggle) but data is local to the browser and not shared between users or devices.
- SQL Databases (e.g., PostgreSQL): Relational databases. Great for complex, structured data with strict schemas. Compared to Firestore, they are harder to set up for real-time frontend updates without additional infrastructure (like WebSockets).
- Evidence:
PostListComponentuses aBehaviorSubject(refreshTrigger) to trigger data re-fetching when the user changes filters or requests a refresh.AuthServiceexposesuser$as anObservable(backed by Firebase Auth state), which multiple components (Navbar,UserProfile) subscribe to for real-time authentication updates.
- Evidence:
PostService,CommentService, andUserServiceare all asynchronous services. They returnObservables orPromises that components subscribe to or await. This ensures the UI doesn't freeze while fetching data from the network.
- Evidence:
- The application uses semantic HTML5 elements (
<header>,<main>,<article>implied by components) and valid Angular templates. All components are structured with proper nesting and valid attributes.
- The application uses semantic HTML5 elements (