{"id":48973,"library":"project-rest-client","title":"Project REST Client","description":"Project-rest-client is a REST API client library designed for React Native and Laravel backends, version 1.3.4. It provides a structured way to interact with Project DB REST APIs, offering features like offline SQL caching, model abstraction, and query building. The library simplifies API integration with configurable endpoints, live data synchronization, and offline support. Compared to generic HTTP clients, it is opinionated towards Laravel/Project DB conventions and includes built-in caching and model management. Release cadence appears low, with limited community adoption.","status":"active","version":"1.3.4","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/kriit24/project-rest-client","tags":["javascript","react-native","laravel","rest api"],"install":[{"cmd":"npm install project-rest-client","lang":"bash","label":"npm"},{"cmd":"yarn add project-rest-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add project-rest-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export; requires ESM environment (e.g., React Native with Babel). CJS require may work but not guaranteed.","wrong":"const ProjectRestClient = require('project-rest-client')","symbol":"ProjectRestClient","correct":"import ProjectRestClient from 'project-rest-client'"},{"note":"Named export for configuration object; don't use default import.","wrong":"import Config from 'project-rest-client'","symbol":"Config","correct":"import { Config } from 'project-rest-client'"},{"note":"Model is exported from the main package, not a subpath. Subpath imports may not be supported.","wrong":"import { Model } from 'project-rest-client/models'","symbol":"Model","correct":"import { Model } from 'project-rest-client'"}],"quickstart":{"code":"import ProjectRestClient from 'project-rest-client';\nimport { Config } from 'project-rest-client';\n\nconst config = new Config({\n  baseURL: 'https://api.example.com',\n  apiKey: process.env.API_KEY ?? ''\n});\n\nconst client = new ProjectRestClient(config);\n\nasync function getUser(id) {\n  try {\n    const user = await client.get(`/users/${id}`);\n    console.log('User:', user);\n  } catch (error) {\n    console.error('Error fetching user:', error);\n  }\n}\n\ngetUser(1);","lang":"typescript","description":"Initializes the REST client with a config object and performs a GET request to fetch a user by ID."},"warnings":[{"fix":"Use only in React Native projects, or provide necessary polyfills for fetch and async storage.","message":"The library is primarily designed for React Native; may not work in Node.js or browser without polyfills.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Always provide baseURL and apiKey. Refer to Config documentation for optional fields.","message":"Config object expects a specific structure; missing fields may cause runtime errors.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use client.get/post/put/delete directly instead of query builder methods.","message":"The query builder API might be deprecated in future versions; prefer using raw endpoints.","severity":"deprecated","affected_versions":">=1.3"},{"fix":"Enable offline mode by setting offline: true in Config and ensuring AsyncStorage is installed.","message":"Offline mode requires additional setup with AsyncStorage; not enabled by default.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Wrap responses or use a generic HTTP client for custom backends.","message":"The library expects a Laravel-style API with specific response structures; non-Laravel backends may fail.","severity":"breaking","affected_versions":">=1.0"}],"env_vars":null,"search_vec":"'1.3.4':22 'abstract':42 'adopt':88 'api':11,34,49,95 'appear':83 'backend':20 'build':45 'built':75 'built-in':74 'cach':40,77 'cadenc':82 'client':3,7,12,64 'communiti':87 'compar':60 'configur':52 'convent':71 'data':55 'db':32,70 'design':14 'endpoint':53 'featur':36 'generic':62 'http':63 'includ':73 'integr':50 'interact':29 'javascript':89 'laravel':19,93 'laravel/project':69 'librari':13,47 'like':37 'limit':86 'live':54 'low':84 'manag':80 'model':41,79 'nativ':17,92 'offer':35 'offlin':38,58 'opinion':67 'project':1,5,31 'project-rest-cli':4 'provid':24 'queri':44 'react':16,91 'react-nat':90 'releas':81 'rest':2,6,10,33,94 'simplifi':48 'sql':39 'structur':26 'support':59 'synchron':56 'toward':68 'version':21 'way':27","created_at":"2026-06-07T16:59:24.790049+00:00","updated_at":"2026-06-07T16:59:24.790049+00:00","problems":[{"fix":"Ensure your API returns data in the format { data: ... } or configure the response mapping.","cause":"The library expects a specific JSON structure from the API (e.g., { data: ... }) but received unexpected format.","error":"TypeError: Cannot read property 'data' of undefined"},{"fix":"Provide baseURL in the Config constructor.","cause":"Config object missing baseURL property.","error":"Error: Config validation failed: baseURL is required"},{"fix":"Only use this package within a React Native project.","cause":"The library depends on React Native but is imported in a non-React Native environment.","error":"Module not found: Can't resolve 'react-native'"},{"fix":"Check the baseURL and ensure the server is running.","cause":"API endpoint unreachable due to network issues or incorrect URL.","error":"Network request failed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/kriit24/project-rest-client/issues#readme","github":"ssh://git@github.com/kriit24/project-rest-client","docs":null,"changelog":null,"pypi":null,"npm":"project-rest-client","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}