Content Management
Collections, entries, locales और releases के साथ एक headless CMS। Content panel या SDK से content manage करें।
Proyecta में एक पूर्ण headless CMS है। यह schema-first है: आप collections (structured content types) define करते हैं, फिर प्रत्येक collection के fields के अनुसार entries बनाते हैं। Entries को localize किया जा सकता है और releases में group किया जा सकता है।
Content panel
Section titled “Content panel”Content को SDK के ज़रिए या AI से पूछकर manage किया जा सकता है। Content API में छह resource types हैं:
| Tab / Resource | यह किसलिए है |
|---|---|
| Collections | Content schemas define और manage करें (जैसे “Blog Post”, “FAQ”, “Product Spec”) |
| Fields | किसी collection के भीतर typed slots (Collections के sub-resource के रूप में manage किए जाते हैं) |
| Entries | किसी collection के भीतर entries browse, create, edit, publish और delete करें |
| Locales | translated content के लिए language/region locales add और manage करें |
| Releases | entries को एक साथ live (या unpublish) करने के लिए group करें; releases.publish() के ज़रिए manually publish करें |
| Assets | media files (images, videos, PDFs) upload और manage करें जिन्हें entries से reference किया जा सके |
Collections tab में किसी collection पर click करने से उसकी entries पर जाएँ। Entries tab से आप individual content items create, edit, publish और delete कर सकते हैं।
आप SDK (proyecta.content) के ज़रिए सब कुछ programmatically भी manage कर सकते हैं।
Concepts
Section titled “Concepts”| Concept | यह क्या है |
|---|---|
| Collection | एक schema — एक प्रकार के content की shape (जैसे “Blog Post”, “FAQ”, “Product Spec”) |
| Field | किसी collection में एक typed slot (जैसे title: string, body: rich_text, coverImage: asset) |
| Entry | किसी collection का एक single instance (एक blog post, एक FAQ item) |
| Asset | एक uploaded media file जिसे entries से reference किया जा सके |
| Locale | एक language/region जिसमें content translate किया जाता है |
| Release | entries का एक group जो एक ही समय पर live (या unpublish) होने के लिए scheduled हो |
Quickstart
Section titled “Quickstart”import Proyecta from '@proyecta-ai/sdk';
const proyecta = new Proyecta({ apiKey: process.env.PROYECTA_API_KEY });
// 1. Define a collectionconst blog = await proyecta.content.collections.create({ api_id: 'blogPost', name: 'Blog Post', // fields are added via collections.fields.create()});
// 2. Create an entryconst post = await proyecta.content.entries.create({ collection_id: blog.id, data: { title: 'Hello, world', body: 'My very first post.', },});
// 3. Publish itawait proyecta.content.entries.publish({ entryId: post.id });Collections
Section titled “Collections”// Browse collectionsfor await (const collection of proyecta.content.collections.list()) { console.log(collection.name);}
// Add or remove fields on a collectionawait proyecta.content.collections.fields.create(blog.id, { /* field definition */});await proyecta.content.collections.fields.delete(blog.id, fieldId);Entries
Section titled “Entries”Entries वास्तविक content rows होती हैं। प्रत्येक entry किसी collection से संबंधित होती है और उस collection के fields से मेल खाता data रखती है।
// Browse entries (pass the collection's api_id, not its numeric id)for await (const entry of proyecta.content.entries.list({ collection: 'blogPost' })) { console.log(entry);}
// Update an entryawait proyecta.content.entries.update(post.id, { data: { title: 'Updated title' } });
// Publish an entryawait proyecta.content.entries.publish({ entryId: post.id });
// Delete an entryawait proyecta.content.entries.delete(post.id);Assets
Section titled “Assets”Asset uploads पूरी तरह first-class हैं — इनका उपयोग करके अपनी entries में images, videos या PDFs attach करें:
// Browse assetsfor await (const asset of proyecta.content.assets.list()) { console.log(asset);}
// Upload, update, or delete via assets.create / assets.update / assets.deleteChat-driven file uploads (drag-into-builder) के लिए देखें Files & Media।
Localization
Section titled “Localization”Content को कई locales में translate किया जा सकता है। प्रत्येक locale एक record है जिसे proyecta.content.locales के ज़रिए manage किया जाता है:
await proyecta.content.locales.create({ /* code, name, etc. */});
for await (const locale of proyecta.content.locales.list()) { console.log(locale);}जब आप entries fetch करते हैं, तो किसी specific locale का translation request कर सकते हैं। व्यापक i18n picture के लिए देखें Internationalization।
Releases
Section titled “Releases”एक release उन entries का bundle होता है जो एक ही समय पर live (या unpublish) होती हैं। इससे आप एक coordinated content drop — कोई marketing launch, नई product page, या FAQ refresh — stage कर सकते हैं और सब कुछ atomically flip हो जाता है।
Note: Automatic timed publishing अभी implement नहीं हुई है।
scheduled_atdate वाले releasesscheduledstatus में आते हैं लेकिन उन्हेंreleases.publish()के ज़रिए manually publish करना होगा। निर्धारित समय पर auto-publishing जल्द आने वाली है।
// Create a release (optionally with a target date)const release = await proyecta.content.releases.create({ name: 'Monday launch', scheduled_at: '2024-01-08T09:00:00Z',});
// Manually publish a release when readyawait proyecta.content.releases.publish({ releaseId: release.id });
// Browse releasesfor await (const r of proyecta.content.releases.list()) { console.log(r);}किसी release का schedule बदलने के लिए उसे delete करके दोबारा बनाएँ — कोई update endpoint नहीं है।
सामान्य patterns (AI से wire up करवाएँ)
Section titled “सामान्य patterns (AI से wire up करवाएँ)”"Build a blog using the Proyecta Content API. Collection 'Blog Post' with fields: title, slug, excerpt, body (rich text), coverImage (asset), author. Public route at /blog and /blog/[slug].""Create an FAQ collection in Proyecta Content. Build an admin page where I can add/edit FAQs and a public /faq page.""Set up a multi-language landing page using Proyecta Content with English and Spanish locales.""Create a release containing three blog posts and publish it manually when ready."
Content बनाम Database: कब क्या उपयोग करें
Section titled “Content बनाम Database: कब क्या उपयोग करें”| Use case | यह उपयोग करें |
|---|---|
| Editorial content (posts, FAQs, marketing copy) — publish/draft states, scheduling, localization की ज़रूरत है | Content API |
| App data (users, orders, line items) — query speed, transactions, real-time की ज़रूरत है | Database |
| Code में static assets | आपके project में public/ directory |
| User द्वारा upload की गई files | Files & Media |
जल्द आने वाला है
Section titled “जल्द आने वाला है”- Rich-text entry editor — Content panel में
rich_textfields के लिए पूर्ण WYSIWYG editing - Live preview — आपके app के विरुद्ध content changes का live preview
- Content roles — editor permissions को developer permissions से अलग करना