Re-Shell CLI'yi Geliştirmek: Açık Kaynak Yolculuğum
Her geliştirici eninde sonunda kendi araçlarını yapar. Benim için o araç Re-Shell CLI oldu; mikroservisleri ve mikrofrontend'leri tek bir güçlü CLI altında birleştiren, modern dağıtık uygulamalar geliştirmeye yönelik kapsamlı bir platform.
Sorun
Mikroservisler ve mikrofrontend'lerle birden fazla projede çalışırken, aynı kalıpların ortaya çıktığını fark ettim:
- Her yeni servis için tekrar eden şablon kodları (boilerplate)
- Ekipler arasında tutarsız proje yapıları
- Karmaşık dağıtım orkestrasyonu
- Paylaşılan yapılandırmaları sürdürmenin zorluğu
Mevcut araçlar ya çok şey yapıyordu (satıcıya bağımlılık) ya da çok az şey (sadece iskelet oluşturma).
Vizyon
Re-Shell, orta yolu bulmayı hedefliyor; gerçek üretkenlik kazanımları sağlayacak kadar görüş sahibi, ancak farklı teknoloji yığınlarına uyum sağlayacak kadar esnek:
bash# Create a new distributed application
reshell init my-platform
# Add a new microservice
reshell add service user-service --template node-fastify
# Add a microfrontend
reshell add frontend dashboard --template react-vite
# Run everything locally
reshell dev
# Deploy to production
reshell deploy --env production
Teknik Mimari
CLI, TypeScript ile geliştirildi ve eklenti tabanlı bir mimari izliyor:
typescript// Core CLI structure
import { Command } from 'commander';
import { loadPlugins } from './plugin-loader';
const program = new Command();
program
.name('reshell')
.description('Unified CLI for distributed applications')
.version('1.0.0');
// Dynamic command loading from plugins
const plugins = await loadPlugins();
plugins.forEach(plugin => {
plugin.registerCommands(program);
});
program.parse();
Eklenti Sistemi
Her yetenek ayrı bir eklenti:
typescript// Plugin interface
export interface ReShellPlugin {
name: string;
version: string;
registerCommands: (program: Command) => void;
hooks?: {
preInit?: () => Promise<void>;
postInit?: () => Promise<void>;
preBuild?: () => Promise<void>;
postBuild?: () => Promise<void>;
};
}
// Example: Service Generator Plugin
export const serviceGeneratorPlugin: ReShellPlugin = {
name: 'service-generator',
version: '1.0.0',
registerCommands: (program) => {
program
.command('add service <name>')
.description('Add a new microservice')
.option('-t, --template <template>', 'Service template', 'node-express')
.option('-p, --port <port>', 'Default port')
.action(async (name, options) => {
await generateService(name, options);
});
}
};
Şablon Motoru
Servisler ve frontend'ler, özelleştirilebilir şablonlardan üretiliyor:
typescript// Template processing
export const processTemplate = async (
templatePath: string,
outputPath: string,
variables: Record<string, string>
) => {
const files = await glob(`${templatePath}/**/*`, { nodir: true });
for (const file of files) {
let content = await fs.readFile(file, 'utf-8');
// Replace template variables
for (const [key, value] of Object.entries(variables)) {
content = content.replace(
new RegExp(`\\{\\{${key}\\}\\}`, 'g'),
value
);
}
// Process filename variables
const relativePath = path.relative(templatePath, file);
const processedPath = relativePath.replace(
/\{\{(\w+)\}\}/g,
(_, key) => variables[key] || ''
);
const outputFile = path.join(outputPath, processedPath);
await fs.mkdir(path.dirname(outputFile), { recursive: true });
await fs.writeFile(outputFile, content);
}
};
Çalışma Alanı Yapılandırması
Merkezi bir yapılandırma dosyası tüm servisleri yönetir:
yaml# reshell.yaml
name: my-platform
version: 1.0.0
services:
user-service:
type: microservice
template: node-fastify
port: 3001
dependencies:
- database
- cache
product-service:
type: microservice
template: node-express
port: 3002
dependencies:
- database
frontends:
dashboard:
type: microfrontend
template: react-vite
port: 5173
remotes:
- shared-ui
customer-portal:
type: microfrontend
template: react-vite
port: 5174
shared:
database:
type: postgres
version: 15
cache:
type: redis
version: 7
environments:
development:
compose: true
production:
provider: kubernetes
namespace: my-platform
Açık Kaynaktan Çıkarılan Dersler
1. Dokümantasyon Her Şeydir
Kodunuz ne kadar iyi olursa olsun, kötü dokümantasyon benimsenmeyi öldürür. Dokümantasyona da kod kadar zaman ayırdım.
2. Küçük Başlayın
İlk sürümde yalnızca init ve dev komutları vardı. Özellikler, gerçek kullanım geri bildirimine dayanarak büyüdü.
3. Kendi Aracınızı Kendiniz Kullanın
Re-Shell'i kendi projelerimde kullanıyorum. Hiçbir şey hataları gerçek kullanımdan daha hızlı bulamaz.
4. Topluluk Önemlidir
Küçük bir kullanıcı tabanıyla bile, gelen geri bildirimler ve katkılar paha biçilmez oldu.
Sırada Ne Var
Mevcut geliştirme şunlara odaklanıyor:
- Bulut sağlayıcı eklentileri - AWS, GCP, Azure dağıtım otomasyonu
- İzleme entegrasyonu - Yerleşik gözlemlenebilirlik (observability) kurulumu
- Yapay zekâ desteği - Doğal dille servis üretimi
Katkıda Bulunmak
Re-Shell açık kaynaktır ve katkıları memnuniyetle karşılar:
bash# Clone the repository
git clone https://github.com/Re-Shell/cli.git
# Install dependencies
npm install
# Run in development mode
npm run dev
# Run tests
npm test
İster küçük bir yan proje ister karmaşık bir kurumsal sistem geliştiriyor olun, Re-Shell dağıtık uygulama geliştirmeyi daha erişilebilir kılmayı amaçlıyor. github.com/Re-Shell/cli adresinden göz atın ve ne düşündüğünüzü bana bildirin!