latterworks commited on
Commit
e6f855b
Β·
verified Β·
1 Parent(s): 5f31b17

Develop a full-stack, interactive web application named `MySpaceBlastFromPast` that exhaustively emulates the core visual and functional experience of **MySpace as it appeared specifically between 2005 and 2007**, replicating its default aesthetics (light blue body background #EBF2F9, specific link colors, blocky layouts) and iconic features.

Browse files

The entire project must be structured as a **PNPM monorepo**, containing exactly two distinct packages:
1. `frontend/`: A React 18.x application using TypeScript 5.x (TSX) and Vite 5.x.
2. `backend/`: A Node.js 20.x Express 4.x API using TypeScript.

**I. `backend/` Specifications:**

1. **Technology:** Node.js 20.x, Express 4.x, TypeScript, `ts-node` for development, `nodemon`.
2. **Data Storage:** Implement a purely **in-memory JSON object database**. All data (users, profiles, friends, posts, comments, messages) must be stored in simple JavaScript arrays of objects or nested JSON structures, initialized with a small set of mock data (at least 3 users with full profiles) on server startup. There must be NO external database dependency (e.g., SQLite, PostgreSQL, MongoDB).
3. **API Endpoints:** Develop a RESTful API with the following essential endpoints:
* `POST /api/auth/login`: Authenticate a user, returning a mock JWT (just a base64 encoded string, no verification needed) or simple session ID.
* `POST /api/auth/signup`: Register a new user.
* `GET /api/users/:username`: Retrieve a specific user's public profile data (blurbs, mood, friends, music, custom CSS, blog posts, comments).
* `GET /api/users/:username/friends`: Retrieve the full list of a user's friends.
* `PUT /api/users/:username/profile`: Update the authenticated user's profile information (blurbs, mood, music URL, custom CSS). Requires authentication.
* `PUT /api/users/:username/top-friends`: Update the authenticated user's Top 8 friends list (exact 8 IDs). Requires authentication.
* `POST /api/users/:username/comments`: Post a new comment on a user's profile. Requires authentication.
* `GET /api/users/:username/comments`: Retrieve all comments for a user's profile.
* `POST /api/users/:username/friend-request`: Send a friend request (simple mock implementation, no acceptance flow needed, just add to a pending list). Requires authentication.
* `GET /api/messages`: Retrieve messages for the authenticated user.
* `POST /api/messages`: Send a message from the authenticated user.
* `GET /api/blog/:username`: Retrieve blog posts for a user.
* `POST /api/blog`: Create a new blog post for the authenticated user.
4. **Authentication:** Implement a basic token-based authentication (mock JWT stored in `localStorage` on the frontend, checked by backend middleware) for all protected routes.
5. **Error Handling:** Implement basic error handling middleware for 404 Not Found and 500 Internal Server Error, returning JSON responses.
6. **CORS:** Configure CORS middleware to allow requests from the `frontend/` origin (default Vite development port `http://localhost:5173`).
7. **Project Structure (`backend/`):**
* `src/`:
* `controllers/`: Request handlers for API routes.
* `services/`: Business logic, interacting with the in-memory data store.
* `middleware/`: Authentication and error handling.
* `data/`: `db.ts` containing the in-memory JSON data structure and initial mock data.
* `routes/`: Express router definitions.
* `types/`: TypeScript interfaces for data models.
* `app.ts`: Express application setup.
* `server.ts`: Entry point to start the server.

**II. `frontend/` Specifications:**

1. **Technology:** React 18.x, TypeScript 5.x (TSX), Vite 5.x, React Router DOM 6.x.
2. **Styling:**
* Use **Styled Components 6.x** for all component-level styling.
* Replicate the *exact* MySpace 2005-2007 default visual aesthetic: light blue body background (`#EBF2F9`), standard MySpace header/footer layout, default link colors, and the characteristic blocky, often centered content areas with thin borders.
* Implement **dynamic custom CSS injection** for user profiles: the `ProfilePage` component must accept a raw CSS string from the `backend/`'s user data and inject it into a `<style>` tag *scoped specifically to the profile content area*, allowing users to override backgrounds, fonts, and colors of their profile. This must be the *only* mechanism for profile customization.
3. **Core Pages/Routes:**
* `/`: General "Home" page with a mock news feed/updates section.
* `/login`: User login form.
* `/signup`: User registration form.
* `/profile/:username`: Dynamic user profile page.
* `/friends/:username`: User's friends list page.
* `/edit-profile`: Authenticated user's profile editing page.
* `/messages`: Simple inbox/outbox for private messages.
* `/blog/:username`: User's blog page.
* `/music/:username`: User's music player page.
4. **Essential Components & Functionalities (for 2005-2007 MySpace emulation):**
* **Global Navigation:** Replicate the iconic MySpace top navigation bar (Home, Profile, Friends, Mail, Blog, etc.) and footer links.
* **Profile Page (`/profile/:username`):**
* **User Header:** Display username, profile photo (mock image), last online status (mock text).
* **"Blurbs" Section:** Display "About Me," "Who I'd Like To Meet," "Interests" as editable text areas for the *authenticated user* viewing *their own* profile. Otherwise, read-only.
* **"MySpace URL":** Display `myspace.com/:username` link.
* **"Mood":** Display current mood (mock text).
* **Top 8 Friends:** A section displaying exactly 8 user avatars/names (from backend data) linked to their profiles. The authenticated user *must* be able to reorder their own Top 8 using drag-and-drop or simple reordering buttons.
* **Comments Section:** Display comments fetched from the backend. Authenticated users *must* be able to post new comments, which persist via API. Each comment includes commenter's name, profile picture, and timestamp.
* **Blog Section:** Display recent blog posts from the user.
* **Music Player:** Embed a single HTML `<audio>` element with visible play/pause/stop controls, playing an MP3 URL fetched from the user's profile data.
* **Friends List Page (`/friends/:username`):** Display a paginated list of friends with profile pictures and names. An "Add Friend" button must appear on other users' profiles, triggering a mock friend request via API.
* **Login/Signup:** Implement functional forms. Upon successful login, store the mock JWT from the backend in `localStorage` and redirect to the authenticated user's own profile. Implement a "Logout" button.
* **Form Handling:** Use `useState` for form inputs. No external form libraries.
* **API Interaction:** Use `fetch` API or `axios` for all backend communication.
* **State Management:** Use React Context API for managing global authentication state (current user, token). `useState` and `useEffect` for local component state.
5. **Project Structure (`frontend/`):**
* `src/`:
* `assets/`: Images (e.g., default profile pic, MySpace logo), mock audio files.
* `components/`: Reusable UI components (e.g., `Button.tsx`, `FriendCard.tsx`, `CommentBox.tsx`, `MusicPlayer.tsx`, `TopFriends.tsx`, `MySpaceHeader.tsx`, `MySpaceFooter.tsx`).
* `pages/`: Top-level page components (e.g., `HomePage.tsx`, `ProfilePage.tsx`, `LoginPage.tsx`, `EditProfilePage.tsx`).
* `hooks/`: Custom React hooks (e.g., `useAuth.ts` for auth context, `useApi.ts` for API calls).
* `contexts/`: React Context API providers (e.g., `AuthContext.tsx`).
* `services/`: API interaction logic (e.g., `api.ts`, `authService.ts`, `userService.ts`, `postService.ts`).
* `styles/`: `GlobalStyles.ts` for Styled Components base styles, `theme.ts` (if applicable).
* `types/`: TypeScript interfaces for API responses and data models.
* `App.tsx`: Main application component, including Router setup.
* `main.tsx`: Entry point for Vite.

**III. Monorepo Setup & General Requirements:**

1. **PNPM:** Use `pnpm workspace` to manage `frontend/` and `backend/` as separate packages within a single repository.
2. **Dependencies:** Manage all package dependencies within their respective `package.json` files.
3. **Development Setup:** Provide clear `pnpm run dev:frontend` and `pnpm run dev:backend` scripts in the root `package.json` to concurrently start both the React dev server (defaulting to port 5173) and the Node.js API server (defaulting to port 3001).
4. **Code Quality:** All code (TSX, TS) must adhere to strict TypeScript type safety, using appropriate interfaces and types. Follow common React best practices (component composition, minimal prop drilling, hooks usage).
5. **Definition of "Full Emulator":** The emulator is considered "full" if it provides all specified pages and their core interactive functionalities (login, profile view, profile editing including Top 8 and custom CSS, comments, basic messaging view, music play/pause) with the visual fidelity of MySpace 2005-2007. Missing non-core features like bulletins, groups, or events are acceptable omissions for this "full" definition.
6. **No External Libraries/APIs:** Strictly no use of external social media APIs, complex UI kits, or database systems beyond what is explicitly stated (React, Styled Components, React Router, Vite, Node.js, Express, in-memory JSON data).

Files changed (2) hide show
  1. README.md +8 -5
  2. index.html +222 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Myspacetimemachine
3
- emoji: πŸ“Š
4
- colorFrom: red
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: MySpaceTimeMachine πŸš€
3
+ colorFrom: yellow
4
+ colorTo: pink
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://deepsite.hf.co).
index.html CHANGED
@@ -1,19 +1,223 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>MySpace Time Machine</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://unpkg.com/feather-icons"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script>
11
+ tailwind.config = {
12
+ darkMode: 'class',
13
+ theme: {
14
+ extend: {
15
+ colors: {
16
+ myspace: {
17
+ light: '#EBF2F9',
18
+ link: '#3B5998',
19
+ accent: '#6699CC'
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
25
+ </script>
26
+ <style>
27
+ body {
28
+ font-family: Arial, sans-serif;
29
+ background-color: #111 !important;
30
+ }
31
+ .myspace-header {
32
+ background: linear-gradient(to bottom, #333, #222);
33
+ border-bottom: 1px solid #444;
34
+ }
35
+ .myspace-nav a:hover {
36
+ color: #6699CC !important;
37
+ }
38
+ .profile-box {
39
+ background-color: #222;
40
+ border: 1px solid #444;
41
+ }
42
+ .comment-box {
43
+ background-color: #1a1a1a;
44
+ border: 1px solid #333;
45
+ }
46
+ </style>
47
+ </head>
48
+ <body class="bg-gray-900 text-gray-200">
49
+ <!-- MySpace Header -->
50
+ <header class="myspace-header py-2 px-4 shadow-md">
51
+ <div class="container mx-auto flex justify-between items-center">
52
+ <div class="flex items-center space-x-4">
53
+ <h1 class="text-2xl font-bold text-myspace-accent">MySpace Time Machine</h1>
54
+ <nav class="hidden md:flex space-x-6 myspace-nav">
55
+ <a href="#" class="text-gray-300 hover:text-myspace-accent">Home</a>
56
+ <a href="#" class="text-gray-300 hover:text-myspace-accent">Browse</a>
57
+ <a href="#" class="text-gray-300 hover:text-myspace-accent">Search</a>
58
+ <a href="#" class="text-gray-300 hover:text-myspace-accent">Invite</a>
59
+ <a href="#" class="text-gray-300 hover:text-myspace-accent">Mail</a>
60
+ </nav>
61
+ </div>
62
+ <div class="flex items-center space-x-4">
63
+ <a href="#" class="text-gray-300 hover:text-myspace-accent">Help</a>
64
+ <a href="#" class="text-gray-300 hover:text-myspace-accent">Sign Up</a>
65
+ <a href="#" class="text-gray-300 hover:text-myspace-accent">Login</a>
66
+ </div>
67
+ </div>
68
+ </header>
69
+
70
+ <!-- Main Content -->
71
+ <main class="container mx-auto py-6 px-4">
72
+ <div class="grid grid-cols-1 md:grid-cols-4 gap-6">
73
+ <!-- Left Column -->
74
+ <div class="md:col-span-1">
75
+ <div class="profile-box rounded p-4 mb-6">
76
+ <div class="text-center mb-4">
77
+ <img src="http://static.photos/people/200x200/42" alt="Profile" class="w-24 h-24 rounded-full mx-auto border-2 border-myspace-accent">
78
+ <h2 class="text-xl font-bold mt-2">Username</h2>
79
+ <p class="text-sm text-gray-400">Last Login: 5 minutes ago</p>
80
+ </div>
81
+ <div class="mb-4">
82
+ <h3 class="font-bold text-myspace-accent mb-2">MySpace URL</h3>
83
+ <p class="text-sm">myspace.com/username</p>
84
+ </div>
85
+ <div class="mb-4">
86
+ <h3 class="font-bold text-myspace-accent mb-2">Mood</h3>
87
+ <p class="text-sm">Happy 😊</p>
88
+ </div>
89
+ </div>
90
+
91
+ <div class="profile-box rounded p-4 mb-6">
92
+ <h3 class="font-bold text-myspace-accent mb-3">Top 8 Friends</h3>
93
+ <div class="grid grid-cols-4 gap-2">
94
+ <div class="text-center">
95
+ <img src="http://static.photos/people/100x100/1" alt="Friend" class="w-12 h-12 rounded-full mx-auto border border-myspace-accent">
96
+ <p class="text-xs mt-1">Friend1</p>
97
+ </div>
98
+ <div class="text-center">
99
+ <img src="http://static.photos/people/100x100/2" alt="Friend" class="w-12 h-12 rounded-full mx-auto border border-myspace-accent">
100
+ <p class="text-xs mt-1">Friend2</p>
101
+ </div>
102
+ <div class="text-center">
103
+ <img src="http://static.photos/people/100x100/3" alt="Friend" class="w-12 h-12 rounded-full mx-auto border border-myspace-accent">
104
+ <p class="text-xs mt-1">Friend3</p>
105
+ </div>
106
+ <div class="text-center">
107
+ <img src="http://static.photos/people/100x100/4" alt="Friend" class="w-12 h-12 rounded-full mx-auto border border-myspace-accent">
108
+ <p class="text-xs mt-1">Friend4</p>
109
+ </div>
110
+ <div class="text-center">
111
+ <img src="http://static.photos/people/100x100/5" alt="Friend" class="w-12 h-12 rounded-full mx-auto border border-myspace-accent">
112
+ <p class="text-xs mt-1">Friend5</p>
113
+ </div>
114
+ <div class="text-center">
115
+ <img src="http://static.photos/people/100x100/6" alt="Friend" class="w-12 h-12 rounded-full mx-auto border border-myspace-accent">
116
+ <p class="text-xs mt-1">Friend6</p>
117
+ </div>
118
+ <div class="text-center">
119
+ <img src="http://static.photos/people/100x100/7" alt="Friend" class="w-12 h-12 rounded-full mx-auto border border-myspace-accent">
120
+ <p class="text-xs mt-1">Friend7</p>
121
+ </div>
122
+ <div class="text-center">
123
+ <img src="http://static.photos/people/100x100/8" alt="Friend" class="w-12 h-12 rounded-full mx-auto border border-myspace-accent">
124
+ <p class="text-xs mt-1">Friend8</p>
125
+ </div>
126
+ </div>
127
+ </div>
128
+
129
+ <div class="profile-box rounded p-4">
130
+ <div class="flex justify-between items-center mb-2">
131
+ <h3 class="font-bold text-myspace-accent">Music Player</h3>
132
+ <i data-feather="music"></i>
133
+ </div>
134
+ <div class="flex justify-center mt-4">
135
+ <audio controls class="w-full">
136
+ <source src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" type="audio/mpeg">
137
+ Your browser does not support the audio element.
138
+ </audio>
139
+ </div>
140
+ </div>
141
+ </div>
142
+
143
+ <!-- Right Column -->
144
+ <div class="md:col-span-3">
145
+ <div class="profile-box rounded p-6 mb-6">
146
+ <h2 class="text-2xl font-bold text-myspace-accent mb-4">About Me</h2>
147
+ <p class="mb-4">Hey there! Welcome to my MySpace profile. I'm a web developer who loves nostalgic websites from the 2000s. Add me as a friend and leave a comment!</p>
148
+
149
+ <h2 class="text-2xl font-bold text-myspace-accent mt-6 mb-4">Who I'd Like To Meet</h2>
150
+ <p>Other nostalgic internet lovers, web developers, and anyone who remembers the golden age of the internet!</p>
151
+ </div>
152
+
153
+ <div class="profile-box rounded p-6 mb-6">
154
+ <div class="flex justify-between items-center mb-4">
155
+ <h2 class="text-2xl font-bold text-myspace-accent">Comments (3)</h2>
156
+ <button class="bg-myspace-accent hover:bg-blue-700 text-white px-3 py-1 rounded text-sm">Add Comment</button>
157
+ </div>
158
+
159
+ <div class="comment-box rounded p-4 mb-4">
160
+ <div class="flex items-start">
161
+ <img src="http://static.photos/people/50x50/10" alt="Commenter" class="w-10 h-10 rounded-full mr-3">
162
+ <div>
163
+ <div class="flex items-center">
164
+ <p class="font-bold text-myspace-accent">Friend1</p>
165
+ <span class="text-xs text-gray-400 ml-2">2 hours ago</span>
166
+ </div>
167
+ <p class="mt-1">Hey there! Love your profile! The dark theme looks awesome!</p>
168
+ </div>
169
+ </div>
170
+ </div>
171
+
172
+ <div class="comment-box rounded p-4 mb-4">
173
+ <div class="flex items-start">
174
+ <img src="http://static.photos/people/50x50/20" alt="Commenter" class="w-10 h-10 rounded-full mr-3">
175
+ <div>
176
+ <div class="flex items-center">
177
+ <p class="font-bold text-myspace-accent">Friend2</p>
178
+ <span class="text-xs text-gray-400 ml-2">5 hours ago</span>
179
+ </div>
180
+ <p class="mt-1">This takes me back! The music player is a nice touch.</p>
181
+ </div>
182
+ </div>
183
+ </div>
184
+
185
+ <div class="comment-box rounded p-4">
186
+ <div class="flex items-start">
187
+ <img src="http://static.photos/people/50x50/30" alt="Commenter" class="w-10 h-10 rounded-full mr-3">
188
+ <div>
189
+ <div class="flex items-center">
190
+ <p class="font-bold text-myspace-accent">Friend3</p>
191
+ <span class="text-xs text-gray-400 ml-2">1 day ago</span>
192
+ </div>
193
+ <p class="mt-1">Remember when we used to spend hours customizing our profiles? Those were the days!</p>
194
+ </div>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ </div>
200
+ </main>
201
+
202
+ <!-- MySpace Footer -->
203
+ <footer class="bg-gray-800 text-gray-400 py-4 px-4 text-sm mt-8">
204
+ <div class="container mx-auto">
205
+ <div class="flex flex-wrap justify-center space-x-4 mb-2">
206
+ <a href="#" class="hover:text-myspace-accent">About</a>
207
+ <a href="#" class="hover:text-myspace-accent">FAQ</a>
208
+ <a href="#" class="hover:text-myspace-accent">Terms</a>
209
+ <a href="#" class="hover:text-myspace-accent">Privacy</a>
210
+ <a href="#" class="hover:text-myspace-accent">Safety Tips</a>
211
+ <a href="#" class="hover:text-myspace-accent">Contact</a>
212
+ </div>
213
+ <div class="text-center">
214
+ <p>Β© 2023 MySpace Time Machine - Reliving the 2000s Internet</p>
215
+ </div>
216
+ </div>
217
+ </footer>
218
+
219
+ <script>
220
+ feather.replace();
221
+ </script>
222
+ </body>
223
  </html>