शुरू करें
साथ में बनाएं AI
पृष्ठ कॉपी करें
हर AI कोडिंग सहायक को एक Lia एप्प सही ढंग से बनाने की आवश्यकता होती है। डॉक्स मार्कडाउन में, llms.txt, एक OpenAPI सर्वर API का स्पेसिफिकेशन, TypeScript प्रकार, और आपके प्रोजेक्ट के लिए एक नियम फ़ाइल।
ये डॉक्स लोगों और AI टूल्स दोनों द्वारा पढ़े जाने के लिए लिखे गए हैं। नीचे दिए गए फ़ाइलों पर अपने सहायक (क्लॉड, ChatGPT, कर्सर, कॉपिलॉट, क्लॉड कोड या कोई अन्य) को लक्षित करें, और नियम फ़ाइल को अपने प्रोजेक्ट में जोड़ें, ताकि यह पहली बार में सही तरीके से Lia कोड लिखे।
#आपके सहायक के लिए
| क्या | कहां | इसके लिए उपयोग करें |
|---|---|---|
| डॉक्स का एक मानचित्र | /llms.txt | आवश्यकताएं और हर पृष्ठ, इसके मार्कडाउन में लिंक। यहां से शुरू करें। |
| एक फ़ाइल में सभी दस्तावेज | /llms-full.txt | जब आपके टूल के लिए आप इसे पेस्ट कर सकते हैं या जोड़ सकते हैं't ब्राउज़ करें। |
| कोई भी पृष्ठ मार्कडाउन के रूप में | जोड़ें .md के लिए अपने पते पर, जैसे /concepts/payments.md | एक विषय एक बार। प्रत्येक पृष्ठ's पृष्ठ कॉपी करें मेनू भी इसी करता है। |
| सर्वर API के रूप में OpenAPI 3.1 | /openapi.json | टाइप किए गए क्लाइंट को बनाना, या एजेंट को API को सही तरीके से कॉल करने की अनुमति देना। |
| आपके प्रोजेक्ट के लिए एक नियम फ़ाइल | /AGENTS.md | नीचे: सबसे महत्वपूर्ण नियम, एक फाइल जिसे सहायक पढ़ते हैं। |
| TypeScript प्रकार | npm install @lia-labs/sdk | हर विधि'आपके पैरामीटर और उत्तर, हर घटना'के डेटा। |
#पृष्ठ कॉपी करें
हर पृष्ठ में एक पृष्ठ कॉपी करें अपने शीर्षक के साथ मेनू के पास:
- मार्कडाउन के रूप में कॉपी करें इस पृष्ठ को आपके क्लिपबोर्ड में रखता है, जिसे चैट में पेस्ट करने के लिए तैयार होता है।
- मार्कडाउन के रूप में देखें इसके मार्कडाउन को खोलता है।
- क्लॉड में खोलें और में खोलें ChatGPT चैट शुरू करें जो पृष्ठ को पढ़ता है।
#अपने प्रोजेक्ट में नियम जोड़ें
इसे बचाएं एस AGENTS.md आपके प्रोजेक्ट में (या CLAUDE.md क्लॉड कोड के लिए, या एक नियम में .cursor/rules/। सहायक इसे पढ़ते हैं जब वे कोड लिखते हैं, इसलिए वे Lia का अनुसरण करते हैं'के नियमों के बिना प्रत्येक बार कहे बिना। यह'से भी एक स्थान पर /AGENTS.md.
# Building a Lia app
This is a web app that runs inside the Lia app (lialabs.org), like a Telegram mini app. Docs: https://docs.lialabs.org (every page as Markdown: add .md; everything: https://docs.lialabs.org/llms-full.txt).
## The SDK
- In a page without a build step: <script src="https://api.lialabs.org/sdk/lia-apps-v1.js"></script> gives window.Lia. Never copy or bundle that file.
- With a bundler: npm install @lia-labs/sdk (or @lia-labs/sdk-react, -preact, -vue, -svelte, -solid, -angular, @lia-labs/elements). Use one or the other on a page, never both.
- Call init() first, then ready() once the first screen is drawn. Outside Lia every call fails with code "not_in_lia"; for local development call mockLia() when isLia() is false.
- Every failure is an Error with a code. "cancelled" from pay() is a normal no, not an error to report.
## Trust
- Never trust the page. Your server verifies a session token (from init() or session(), 15 minutes) with POST https://api.lialabs.org/api/apps/v1/session/verify and takes the player id from Lia's answer, never from the page.
- Secret keys (lia_test_..., lia_live_...) and the webhook secret (whsec_...) live on the server only. The app id is the only public identifier.
- Prices come from Lia's records: the page passes a product id to pay(), never an amount.
## Payments
- pay(productId) opens Lia's pay sheet and answers { chargeId, productId }. The server then checks GET /charges/:id (its player, product and status), gives the item once per charge id, and calls POST /charges/:id/deliver. If it can't deliver, POST /charges/:id/refund.
- On opening, call charges() and deliver any paid, undelivered charges; listen with onCharge() too. Webhooks (charge.paid) are a nudge: check with the API, and verify the Lia-Signature header (HMAC SHA-256 of "<t>.<raw body>" with the whsec_ secret).
## Rewards, ads, notifications
- Pay players in $LIA only from the server: POST /rewards with a key that names the reason (a key pays once, ever). At most 10,000 LIA a reward; handle pool_empty and daily_limit.
- A rewarded video answers { watched, adId }: give the reward only after the server checks POST /ads/verify (watched, and the same player), once per adId.
- Between rounds and games, call Lia.showInterstitialAd() (Lia paces it: about one every 90 seconds and every 2nd round; "too_soon" means carry on). Rewarded videos only behind a button the player chooses (a hint, a second chance), never by themselves between rounds. Test keys always get Google's test ads.
- Banners and native ads (SDK 1.7): Lia.showBanner({ position: "bottom" | "top" }) and Lia.showNativeAd({ placement: "card" | "sheet" }). Lia draws them natively beside the page (the page gets shorter), never inside it: don't build an ad slot in your own HTML for them, just let the layout follow the viewport height. Show the card at pauses (a results screen) and hideNativeAd() when play resumes; both answer { shown: false, reason } when there's nothing to show, so carry on. For an ad inside the page's own content, use the developer's own AdSense or Google Ad Manager tags: Lia lets only Google's ad frames load and opens ad taps in Safari; that revenue is the developer's own, not counted by Lia. For games: pin Lia.showBanner({ position: "top" }) before Lia.ready() and keep it for the visit; put in-page ad rows only on calm screens (home, lobby), never over or under the board; don't use the native card or sheet over gameplay.
- Notifications are opt-in (requestNotifications()), sent by the server with POST /notifications, at most 3 a day per person from one app, an hour apart, 180 characters, no links. Use a startParam to open the right screen.
## Feel like Lia
- Use Lia's theme (CSS variables --lia-bg-color, --lia-text-color, --lia-hint-color...), the safe areas (--lia-safe-area-inset-bottom), Lia.language (13 languages) and Lia.rtl for dir.
- Use Lia's mainButton for the main action, backButton for your own screens, Lia's dialogs and toasts, and play sound only while soundOn.
- Only your own pages load in the frame: open other sites with openLink(url).
## Conventions
- In text people read: "$LIA" for the token, "LIA" next to numbers (5 LIA).
- Retry server POSTs with the same Idempotency-Key header.#अच्छे प्रश्न पूछें
कुछ प्रेरक जो ऊपर के फाइलों के साथ अच्छी तरह से काम करते हैं:
- "पढ़ें https://docs.lialabs.org/llms.txt, फिर रिएक्ट में एक Lia एप्स बनाएं जहां खिलाड़ी 5 LIA के लिए अतिरिक्त जीवन खरीदते हैं, एक नोड सर्वर जो चार्ज की पुष्टि करता है और डिलीवर करता है।"
- "उपयोग करते हुए https://docs.lialabs.org/openapi.json, Lia सर्वर API पर TypeScript में रीट्राइज और इडेम्पोटेंसी-की हेडर के साथ एक टाइप किया गया क्लाइंट लिखें।"
- "पढ़ें https://docs.lialabs.org/guides/multiplayer-with-invites.md और मेरे दो खिलाड़ी खेल में सार्वजनिक तालिकाएं जोड़ें।"
#अगर कुछ'लिखता है गलत
AI टूल्स अभी भी गलतियां कर सकते हैं। द SDK संदर्भ और सर्वर API सत्य का स्रोत हैं, और आपके एप्प का परीक्षण सभी चीजों की जांच कैसे करें, इसका विवरण दिखाता है जब आप लाइव जाते हैं।
स्वचालित अनुवाद। अंग्रेजी सत्य का स्रोत है। अंग्रेजी में पढ़ें