210
订阅者
无数据24 小时
+27 天
+230 天
帖子存档
210
+1
there was a blur mistake (in warning and error pop ups) that was horrible UX
quick fixed it will be released soon (i send the pr) and btw 8k+downloads :)
210
what vpn are you guys are using that works in linux ?
>must have free plan , no way am gonna pay for a vpn
210
> be me
frontend dev trying to deploy a React app on Vercel
put images in public/ like a normal person
compiler: “wArNiNg, pUt iMaGeS iN sRc iNsTeAd”
move images to src/ like a good little dev
now the build explodes like a Samsung Galaxy Note 7
mfw
> okay fine, back to public/
compiler still crying but at least the app works
whatever, ship it
> start backend project with Express, MongoDB, and Zod validation
feeling like a responsible dev
add pagination like a chad
first API call
error: "undefined is not a function"
realize I forgot to .parse() the request body
entire backend is a house of cards held together by console.logs
> meanwhile, working on React Native app
trying to integrate Gemini AI for mood detection
test it with some entries
“I’m feeling pretty okay today”
AI: ”depression 💀”
mfw
> decide to take a break, open my local music & YouTube audio app
forgot I built it in React Native
app boots up
crashes instantly
mfw
> dev life is suffering
210
| Scaling | Automatic and instant. | Manual or complex auto-scaling setup. |
| Use Case | Event-driven, short tasks. | Long-running apps (e.g., databases). |
---
### Why Developers Love Serverless
- 🚀 Rapid Prototyping: Deploy code in minutes.
- 🌍 Edge Computing: Serve users from the nearest location (low latency).
- 💸 Cost-Effective for Sporadic Workloads: Great for startups or apps with unpredictable traffic.
---
### Example: Serverless API in AWS Lambda
// AWS Lambda function (Node.js)
exports.handler = async (event) => {
const response = {
statusCode: 200,
body: JSON.stringify('Hello from serverless!'),
};
return response;
};
---
### Conclusion
Serverless is ideal for event-driven, scalable workloads where you want to offload infrastructure management. It’s not a silver bullet (e.g., not suited for long-running tasks), but it’s revolutionized how developers build modern apps. Frameworks like Hono (for Cloudflare Workers) simplify writing serverless code by providing lightweight, edge-optimized tools.210
Serverless is a cloud computing model where the cloud provider (e.g., AWS, Google Cloud, Cloudflare) manages the server infrastructure for you. Developers focus solely on writing code (e.g., functions, APIs, or apps) without worrying about provisioning, scaling, or maintaining servers. The term "serverless" can be misleading—there are still servers involved, but their management is abstracted away from the developer.
---
### Key Characteristics of Serverless
1. No Server Management:
- You don’t rent or manage physical/virtual servers.
- The cloud provider handles OS updates, security patches, scaling, and uptime.
2. Event-Driven Execution:
- Code runs in response to events (e.g., HTTP requests, database changes, file uploads).
- Example: A function triggers when a user submits a form on your website.
3. Automatic Scaling:
- Resources scale up/down instantly based on demand (no manual configuration).
- Handles traffic spikes gracefully (e.g., 1 user or 1 million users).
4. Pay-Per-Use Pricing:
- You pay only for the compute time your code consumes (e.g., per millisecond of execution).
- No cost when code isn’t running (unlike traditional servers that charge 24/7).
5. Stateless by Default:
- Functions are short-lived and stateless (no persistent memory between runs).
- Store data externally (e.g., databases, object storage).
---
### How Serverless Works
1. Developers Write Code (e.g., a function in JavaScript, Python, Go).
2. Deploy to a Serverless Platform (e.g., AWS Lambda, Cloudflare Workers).
3. Trigger via Events:
- HTTP requests (API Gateway).
- File uploads (e.g., AWS S3).
- Cron jobs (scheduled tasks).
- Database changes (e.g., Firebase Firestore).
4. Provider Executes Code in isolated, ephemeral containers.
5. Billing: You’re charged only for execution time and resources used.
---
### Serverless Use Cases
- APIs/Microservices: Handle HTTP requests (e.g., REST/GraphQL endpoints).
- File/Image Processing: Resize images when uploaded to cloud storage.
- Real-Time Data Processing: Analyze streaming data (e.g., IoT sensors).
- Chatbots/Webhooks: Respond to user interactions (e.g., Slack bots).
- Cron Jobs: Run scheduled tasks (e.g., daily database cleanup).
- Server-Side Rendering (SSR): Render React/Next.js pages at the edge.
---
### Examples of Serverless Platforms
1. Function as a Service (FaaS):
- AWS Lambda
- Google Cloud Functions
- Cloudflare Workers
- Vercel Edge Functions
- Azure Functions
2. Backend as a Service (BaaS):
- Firebase (Auth, Firestore, Cloud Functions)
- Supabase
- Auth0
---
### Benefits of Serverless
- Cost Efficiency: No idle costs (pay only when code runs).
- Simplified DevOps: No server provisioning, scaling, or maintenance.
- Global Scalability: Run code in multiple regions/edge locations.
- Faster Development: Focus on business logic, not infrastructure.
---
### Limitations
- Cold Starts: Slight delay when a function hasn’t been used recently.
- Vendor Lock-In: Code often relies on cloud-specific APIs/tools.
- Execution Limits:
- Timeouts (e.g., 10 seconds on Cloudflare Workers, 15 minutes on AWS Lambda).
- Memory/CPU constraints.
- State Management: Requires external databases (e.g., Redis, DynamoDB).
---
### Serverless vs. Traditional Servers
| Aspect | Serverless | Traditional Servers |
|----------------------|-----------------------------------------|-----------------------------------------|
| Management | Provider handles servers. | You manage servers (OS, scaling, etc.). |
| Cost | Pay per execution. | Pay 24/7, even if idle. |
210
📌 Best Resources for Learning State Management in React
State management is crucial for handling data in React applications. Here’s how to approach it:
1️⃣ Start with React’s Built-in State Management
🔹 useState & useReducer – for managing local state.
🔹 useContext – for sharing state across components.
📘 Learn More: https://react.dev/learn/managing-state
2️⃣ Redux – Best for Large-Scale Applications
Redux is widely used in production apps, and the recommended approach is Redux Toolkit (RTK).
📘 Best Articles & Documentation:
✅ Redux Toolkit Official Docs: https://redux-toolkit.js.org/ (Best way to use Redux today)
📖 Redux Core Docs: https://redux.js.org/ (Deep dive into Redux fundamentals)
📝 Simplified Redux for Beginners: https://daveceddia.com/redux-tutorial/
📺 Best Video Tutorials:
🎥 Redux Toolkit Crash Course – Traversy Media: https://www.youtube.com/watch?v=9zySeP5vH9c (🔥Best for beginners)
🎥 Redux full course-Dave gray https://youtu.be/NqzdVN2tyvQ?si=3rxFF8DJeW4qJKgM
3️⃣ Zustand – Simpler & More Lightweight Alternative
Zustand is great for state management without boilerplate.
📘 Best Articles & Documentation:
✅ Zustand Official Docs: https://docs.pmnd.rs/zustand/getting-started/introduction (Start here!)
📺 Best Video Tutorials:
🎥 Zustand Crash Course – https://youtu.be/_ngCLZ5Iz-0?si=_eSs28K8dLWNnKyC (Short and simple guide)
📚 Zustand vs Redux –https://youtu.be/unDfnI-13SQ?si=4nH28259UmTno9S- (When to use Zustand over Redux)
